Query editor
with prev as (select * from table(previous.query.result(schema => descriptor(day timestamp(3),project varchar,trades bigint,usd_volume double,royalties_usd double)))),checkpoint as (select coalesce(max(day), timestamp '2025-06-01') - interval '1' day as cutofffrom prev),cc_mints as (select account_mintfrom mpl_token_metadata_solana.mpl_token_metadata_call_createwhere call_block_date >= date '2025-06-01'and account_updateAuthority in ('cc2UvAphSgLGd7A9MgRMo3ZUeSvAoagkFtSURGkLTYF', 'cc3novbXuNSe292qKH2gGhxToaWjuBvJbA7zQf8NVxi')unionselect account_mintfrom mpl_token_metadata_solana.mpl_token_metadata_call_createmetadataaccountv3where call_block_date >= date '2025-06-01'and account_updateAuthority in ('cc2UvAphSgLGd7A9MgRMo3ZUeSvAoagkFtSURGkLTYF', 'cc3novbXuNSe292qKH2gGhxToaWjuBvJbA7zQf8NVxi')),new_data as (selectdate_trunc('day', t.block_time) as day, t.project, count(*) as trades, sum(t.amount_usd) as usd_volume, sum(t.royalty_fee_amount_usd) as royalties_usdfrom nft_solana.trades tinner join cc_mints m on m.account_mint = t.account_mintwhere t.block_date >= (select cutoff from checkpoint)and t.trade_category = 'buy'group by 1, 2)select day, project, trades, usd_volume, royalties_usd from prevwhere day < (select cutoff from checkpoint)union allselect day, project, trades, usd_volume, royalties_usd from new_dataorder by day desc, usd_volume desc