select BLOCK_TIMESTAMP::date as date, sum(PRICE) as volume, count(*) as sales_count,
case
when team ilike '%Warriors%' or team ilike '%Celtics%' or team ilike '%Mavericks%' or team ilike '%Heat%' then team
else 'Others'
end as team_tag
from flow.core.fact_nft_sales a
join flow.core.dim_topshot_metadata b
on a.NFT_COLLECTION=b.NFT_COLLECTION and a.NFT_ID=b.NFT_ID
where BLOCK_TIMESTAMP>='2022-05-17' and BLOCK_TIMESTAMP<='2022-05-29'
group by 1,team_tag
order by team_tag desc