Sbhn_NPTotal Number of Sales based on Buyers that bought 3 Top Collections
    Updated 2022-10-20
    with top_10 as ( select nft_address , sum(price_usd) as volume
    from optimism.core.ez_nft_sales
    where price_usd is not null
    group by 1
    order by 2 desc
    limit 11)
    ,
    fnl as ( select buyer_address, count(DISTINCT(project_name)) as total
    from optimism.core.ez_nft_sales a join optimism.core.dim_labels b on a.nft_address = b.address
    where nft_address in ( select nft_address from top_10)
    and block_timestamp::date >= CURRENT_DATE - 120
    group by 1)
    ,
    multi as ( select buyer_address
    from fnl
    where total = 3)

    select trunc(block_timestamp,'week') as date, case when project_name = 'optimistic explorer - get started nft' then 'optimistic explorer'
    else project_name end as collections, count(DISTINCT(tx_hash)) as total_sales, sum(price_usd) as volume
    from optimism.core.ez_nft_sales a join optimism.core.dim_labels b on a.nft_address = b.address
    where nft_address in ( select nft_address from top_10) and buyer_address in (select buyer_address from multi)
    and block_timestamp::date >= CURRENT_DATE - 120
    group by 1,2




    Run a query to Download Data