MLDZMNyts10
    Updated 2022-12-09
    with tb1 as (
    select
    distinct tx_id
    from solana.core.fact_transactions
    where inner_instructions[1]:instructions[3]:accounts[12] ilike 'yootn8Kf22CQczC732psp7qEqxwPGSDQCFZHkzoXp25'
    and block_timestamp >= '2022-11-01'
    and succeeded = 'TRUE'),

    tb2 as (select
    mint
    from solana.core.fact_nft_mints x join tb1 y on x.tx_id = y.tx_id),

    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 mint from tb2)
    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
    Run a query to Download Data