Updated 2022-10-22
    with flowpricet as (
    select TIMESTAMP::date as day, avg (price_usd) as flowprice
    from flow.core.fact_prices
    where symbol ='FLOW' and source ='coinmarketcap'
    group by 1),

    maintable as (
    select seller,
    count (distinct tx_id) as Sales_Count,
    count (distinct nft_id) as Tokens_Count,
    sum (case when t1.currency ='A.1654653399040a61.FlowToken' then t1.price * t2.flowprice else t1.price end) as Total_USD_Volume
    from flow.core.ez_nft_sales t1 join flowpricet t2 on t1.block_Timestamp::Date = t2.day
    where nft_collection = 'A.329feb3ab062d289.RaceDay_NFT'
    and tx_succeeded = 'TRUE'
    group by 1)


    select case when sales_count = 1 then 'Once'
    when sales_count > 1 and sales_count <= 5 then '2 - 5 Times'
    when sales_count > 5 and sales_count <= 10 then '6 - 10 Times'
    else 'More Than 10 Times' end as type,
    count (distinct seller)
    from maintable
    group by 1
    order by 2 desc
    Run a query to Download Data