kasadeghUntitled Query
    Updated 2022-12-06
    with flow_price as
    (
    select timestamp::date as day,
    avg (price_usd) as usdprice
    from flow.core.fact_prices
    where symbol = 'FLOW'
    and source = 'coinmarketcap'
    group by 1
    ),

    all_info as
    (
    select 'ThanksGiving Week' as timespan,
    player,
    count (distinct tx_id) as Sales_Count,
    sum (case when currency = 'A.1654653399040a61.FlowToken' then price*usdprice else price end) as Total_USD_Volume
    from flow.core.ez_nft_sales t1 join flow_price t2 on t1.block_timestamp::Date = t2.day
    join flow.core.dim_allday_metadata t3 on t1.nft_id = t3.nft_id
    where t1.nft_collection = 'A.e4cf4bdc1751c65d.AllDay'
    and tx_succeeded = 'TRUE'
    and block_timestamp >= '2022-11-24' and block_timestamp <= '2022-11-30'
    group by 1,2

    union ALL

    select 'Other Days' as timespan,
    player,
    count (distinct tx_id) as Sales_Count,
    sum (case when currency = 'A.1654653399040a61.FlowToken' then price*usdprice else price end) as Total_USD_Volume
    from flow.core.ez_nft_sales t1 join flow_price t2 on t1.block_timestamp::Date = t2.day
    join flow.core.dim_allday_metadata t3 on t1.nft_id = t3.nft_id
    where t1.nft_collection = 'A.e4cf4bdc1751c65d.AllDay'
    and tx_succeeded = 'TRUE'
    and (block_timestamp < '2022-11-24' or BLOCK_TIMESTAMP >'2022-11-30' )
    group by 1,2
    )
    Run a query to Download Data