HadisehFlow 2
    Updated 2022-07-19
    with tb_flow as ( select date(BLOCK_TIMESTAMP) as daily , sum(price) as total_volume
    from flow.core.fact_nft_sales
    where block_timestamp::date >= CURRENT_DATE - 60
    group by 1
    order by 1),
    price as (select date(hour) as price_date ,
    case when token_address = lower('0xD31a59c85aE9D8edEFeC411D448f90841571b89c')
    then 'SOL' end as token ,
    avg(price) as price
    from flipside_prod_db.ethereum_core.fact_hourly_token_prices
    where token_address = lower('0xD31a59c85aE9D8edEFeC411D448f90841571b89c')
    and hour::date >= CURRENT_DATE - 60
    group by 1,2) ,
    tb_solana as (select date(BLOCK_TIMESTAMP) as daily
    , sum(SALES_AMOUNT*price) as total_volume
    from solana.core.fact_nft_sales x join price y on x.BLOCK_TIMESTAMP::date = y.price_date
    where block_timestamp::date >= CURRENT_DATE - 60
    group by 1
    order by 1),

    tb_ethereum as (select date(BLOCK_TIMESTAMP) as daily, sum(PRICE_USD) as total_volume
    from ethereum.core.ez_nft_sales
    where block_timestamp::date >= CURRENT_DATE - 60
    group by 1
    order by 1)

    select 'Flow' as platform , daily , total_volume from tb_flow
    UNION
    select 'Solana' as platform , daily , total_volume from tb_solana
    UNION
    select 'Ethereum' as platform , daily , total_volume from tb_ethereum

    Run a query to Download Data