drone-mostafaUntitled Query
    Updated 2022-09-28
    with
    base as (
    WITH
    userss as (
    select 'buyers' as type ,PURCHASER, BLOCK_TIMESTAMP from solana.core.fact_nft_sales
    UNION ALL
    select 'sellers' as type ,SELLER , BLOCK_TIMESTAMP from solana.core.fact_nft_sales )

    select
    MARKETPLACE,
    mint,
    sales_amount,
    tx_id,
    block_timestamp as Datea
    from solana.core.fact_nft_sales
    where Datea >= CURRENT_DATE -90 and Datea < CURRENT_DATE and succeeded = 'TRUE' and marketplace in ('yawww')
    ),

    Top10 as (select
    initcap(ifnull(label, project_name)) as label,
    case when inner_instructions[0]:instructions[7]:parsed:info:lamports is null then 'No Royalty' else 'With Royalty' end as ctg, count(distinct(a.tx_id)) as tx, sum(sales_amount) as sales
    from solana.core.fact_transactions a
    join base b
    on a.tx_id = b.tx_id
    left join solana.core.dim_nft_metadata c
    on b.mint = c.mint
    left join solana.core.dim_labels d
    on b.mint = d.address
    where a.succeeded = 'TRUE' and a.block_timestamp >= CURRENT_DATE -90 and a.block_timestamp < CURRENT_DATE and ctg = 'No Royalty' and label is not null group by 1,2 order by 4 desc limit 10

    )
    Run a query to Download Data