with tab1 as (
select ADDRESS,ADDRESS_NAME
from solana.core.dim_labels
where ADDRESS_NAME ilike '%Blockasset Legends%'or
ADDRESS_NAME in('The Suites','Laidback Lions','Hockey Heroes','Collectorz Club: The Collectorz','Sports Rewind')),
tab2 as (
select date_trunc('month',BLOCK_TIMESTAMP) as month,MINT,MARKETPLACE,TX_ID
from solana.core.fact_nft_sales
group by 1,2,3,4)
select MARKETPLACE,count(distinct TX_ID)as sales_on_market
,case
when ADDRESS_NAME ilike'%Blockasset Legends%' then 'Blockasset Legends' else ADDRESS_NAME end as sport_collections
from tab1
left join tab2
on tab1.ADDRESS=tab2.MINT
where MARKETPLACE is not null
group by 1,3