Query editor
WITHlents AS (SELECTCOUNT(*) AS "Number of listings" /* Count transactions to figure out total number of lents. */,TRY_CAST(DATE_TRUNC('day', evt_block_time) AS DATE) AS day /* Truncate the day and group by day. */FROMrenft_ethereum.Registry_evt_LendGROUP BY2),fill_dates AS (SELECTTRY_CAST(dt AS TIMESTAMPWITHTIME ZONE) AS dFROMUNNEST (SEQUENCE(CURRENT_DATE - /* Last 30 days */ INTERVAL '30' day,CURRENT_DATE,INTERVAL '1' day)) AS _u (dt)),dates AS (SELECT*FROMlentsRIGHT JOIN fill_dates /* Right join to get all the matching dates with the transactions as well as the empty dates. */ ON lents.day = fill_dates.d) /* Join on date. */SELECTDATE_TRUNC('day', d),"Number of listings"FROMdates