SELECT * from
(
SELECT *,
row_number() over (partition by platform_name order by total_txs desc ) as rn from
(SELECT * from
(SELECT * from
(SELECT platform_name, nft_address,
COUNT(DISTINCT tx_hash) as total_txs
from ethereum.core.ez_nft_sales
where date(block_timestamp) >= CURRENT_DATE - {{n}} and nft_address is not NULL and price_usd is not NULL
GROUP by 1,2
) ) join ethereum.core.dim_labels
on address = nft_address
))
where rn < 4
-- LIMIT 100