HosseinUntitled Query
    Updated 2022-10-23
    with t1 as (
    select tx_id, event_data:id as nft
    from flow.core.fact_events
    where event_type = 'Minted'
    and event_contract = 'A.329feb3ab062d289.RaceDay_NFT'
    ),
    t3 as (
    select date_trunc('day', t2.block_timestamp) date,
    t2.event_data:to minter_address,
    count(t2.event_data:id) mints_count,
    count(distinct(t2.tx_id)) tx_sales,
    row_number() over (partition by date order by mints_count desc, tx_sales desc) as n
    from flow.core.fact_events t2
    where exists (
    select * from t1 where t1.nft = t2.event_data:id and t1.tx_id = t2.tx_id
    )
    and event_type ='Deposit'
    and event_data:to != 'null'
    and event_contract = 'A.329feb3ab062d289.RaceDay_NFT'
    group by date, minter_address
    qualify n = 1
    order by date asc
    )

    select date, minter_address, mints_count , tx_sales from t3
    order by date asc
    Run a query to Download Data