with flow_whale as (
select buyer ,
count(DISTINCT tx_id) as sale_count,
sum(price) as volume
from flow.core.fact_nft_sales
group by 1
order by 3 desc
limit 100
)
, flow as (
select
nft_collection ,
count(DISTINCT tx_id) as sale_count
from flow.core.fact_nft_sales
where block_timestamp::date >= '2022-05-09'
and buyer in ( select buyer from flow_whale)
group by 1
order by 2 desc
)
select
CONTRACT_NAME ,
sale_count
from flow.core.dim_contract_labels a join flow b on a.event_contract = b.nft_collection
where sale_count is not null
order by 2 desc
limit 10