MLDZMNportal7
    Updated 2022-12-23
    with tb1 as (
    select
    Label,
    ADDRESS as mints
    from solana.core.dim_labels
    where LABEL ilike '%portals%'),

    tb3 as (select
    recorded_hour::date as day,
    avg (close) as price_token
    from solana.core.fact_token_prices_hourly
    where symbol = 'SOL'
    group by 1),

    tb4 as (select
    distinct purchaser as sender,
    count(distinct TX_ID) as no_transaction
    from solana.core.fact_nft_sales x join tb3 y on x.BLOCK_TIMESTAMP::date=y.day
    where SUCCEEDED='TRUE'
    and mint in (select mints from tb1)
    and SALES_AMOUNT>0
    group by 1)

    select
    case
    when no_transaction=1 then 'One time purchaser'
    when no_transaction>1 and no_transaction <5 then '1-5 times purchaser'
    when no_transaction>5 then 'More than 5 times purchaser'
    end as gp,
    count(distinct sender)
    from tb4
    group by 1 having gp is not null
    Run a query to Download Data