Query editor
-- This query used incompatible data types from Dune SQL alpha and may need to be updated.-- More details can be found on https://dune.com/docs/query/dunesql-changes/with date_filter as (select (casewhen '{{date_period}}' = '7 Days' then now() - interval '7' daywhen '{{date_period}}' = '30 Days' then now() - interval '30' daywhen '{{date_period}}' = '3 Months' then now() - interval '3' monthwhen '{{date_period}}' = '6 Months' then now() - interval '6' monthelse date('2022-05-18')end) as start_date),profile_filter as (select profileIdfrom (select 1 as sort,profileIdfrom lens_polygon.LensHub_evt_ProfileCreatedwhere handle = '{{profile_handle}}'union allselect 2 as sort,profileIdfrom lens_polygon.LensHub_evt_ProfileCreatedwhere handle = '{{profile_handle}}.lens'union allselect 3 as sort, uint256 '0' as profileId) torder by sortlimit 1),post_data as (select evt_block_time,evt_tx_hash,p.profileId,pubId,contentURI,collectModule,referenceModulefrom lens_polygon.LensHub_evt_PostCreated pinner join date_filter d on trueinner join profile_filter f on truewhere evt_block_time > d.start_dateand (f.profileId = uint256 '0' or f.profileId = p.profileId)),post_daily_summary as (select date_trunc('day', evt_block_time) as block_date,count(*) post_count,count(distinct profileId) as profile_countfrom post_datagroup by 1)select block_date,post_count,