with tab as (select
distinct project_name,
count(distinct tx_id) as sales_count,
count(distinct purchaser) as buyers_count,
sum(sales_amount) as sales_volume
from solana.core.fact_nft_sales t1
join solana.core.dim_nft_metadata t2 on t1.mint = t2.mint
where marketplace = 'coral cube'
group by 1 order by 4 desc
limit 10)
select
date_trunc('week',block_timestamp) as date,
project_name,
count(distinct tx_id) as sales_count,
count(distinct purchaser) as buyers_count,
sum(sales_amount) as sales_volume
from solana.core.fact_nft_sales t1
join solana.core.dim_nft_metadata t2 on t1.mint = t2.mint
where marketplace = 'coral cube'
and project_name in (select project_name from tab)
group by 1,2
order by date asc