greyswanNFT-DEFI intersection_rich
    Updated 2023-03-07
    with
    rich_NFTs as (
    select
    date_trunc('month', block_timestamp) as NFT_month,
    purchaser,
    avg(sales_amount) as average_buy
    from
    solana.core.fact_nft_sales
    where
    block_timestamp >= '2022-03-01'
    and block_timestamp <= '2023-02-28'
    group by
    purchaser,
    NFT_month
    having
    average_buy >= 100
    ),
    unique_NFT_users as (
    SELECT
    NFT_month,
    purchaser as seller_purchaser
    from
    rich_NFTs
    ),
    txs_by_NFTS as (
    select
    NFT_month,
    seller_purchaser,
    program_ID
    from
    unique_NFT_users
    left join solana.core.fact_events on seller_purchaser = signers[0]
    and NFT_month = date_trunc('month', block_timestamp)
    where
    succeeded = 'true'
    and block_timestamp >= '2022-03-01'
    Run a query to Download Data