Updated 2022-10-23
    with tab0 as ( SELECT BUYER as buyers
    from flow.core.ez_nft_sales
    where NFT_COLLECTION ilike '%raceday%'
    and TX_SUCCEEDED ilike '%TRUE%'
    ) ,
    tab1 as (
    SELECT nft_id , max(block_timestamp) as last_sale
    from flow.core.ez_nft_sales A, tab0 B
    where TX_SUCCEEDED ilike '%TRUE%'
    and buyers = buyer
    GROUP by 1
    )
    SELECT buyer ,
    case
    when NFT_COLLECTION = 'A.329feb3ab062d289.RaceDay_NFT' then 'RaceDay'
    else 'Other NFTs'
    end as type ,
    count(A.nft_id) as number
    from tab1 A , flow.core.ez_nft_sales B
    where TX_SUCCEEDED ilike '%TRUE%'
    and last_sale = block_timestamp
    and A.nft_id = B.nft_id

    GROUP by 1 , 2
    Run a query to Download Data