0-MID4 copy copy
    Updated 2024-01-16

    with tab1 as (
    select date_trunc('minute',BLOCK_TIMESTAMP) as time
    ,PRICE_USD
    ,BUYER_ADDRESS
    ,SELLER_ADDRESS
    from bsc.nft.ez_nft_sales
    ),
    tab2 as (
    select date_trunc('week',time) as week
    ,PRICE_USD
    ,BUYER_ADDRESS
    ,SELLER_ADDRESS
    ,row_number()over(partition by SELLER_ADDRESS order by week) as times_row
    from tab1)
    select week
    ,count(SELLER_ADDRESS) as new_sellers
    ,sum(PRICE_USD) as volume
    ,sum(new_sellers)over(order by week) as total_new_sellers
    ,sum(volume)over(order by week) as total_volume
    from tab2
    where times_row=1
    group by 1





    QueryRunArchived: QueryRun has been archived