with
top_shot_buyer as (
select distinct buyer as topshot_buyer
from flow.core.fact_nft_sales
where nft_collection = 'A.0b2a3299cc857e29.TopShot'
),
allday_sales as (
select buyer, date_trunc('day', block_timestamp::date) as TIME
from flow.core.fact_nft_sales
where nft_collection = 'A.e4cf4bdc1751c65d.AllDay'
and block_timestamp > '2022-05-09'
group by TIME, buyer
)
select count(a.buyer) as buyer, 'common' as label, a.TIME
from allday_sales a
inner join top_shot_buyer t on t.topshot_buyer = a.buyer
group by a.TIME, label
UNION
select count(a.buyer) as buyer,'regular' as label, a.TIME
from allday_sales a
group by a.TIME, label