MLDZMNFUR-NFT-1
    Updated 2022-12-20
    with tb1 as (select
    BLOCK_TIMESTAMP,
    BUYER,tx_id,
    ROW_NUMBER() OVER (partition by BUYER order by BLOCK_TIMESTAMP) as t_n
    from flow.core.ez_nft_sales where block_timestamp >= '2022-01-01'
    and TX_SUCCEEDED='TRUE'
    ),

    tb2 as (select
    BLOCK_TIMESTAMP as first_transaction,
    BUYER
    from tb1
    where t_n=1),

    tb3 as (select
    BLOCK_TIMESTAMP as second_transaction,
    BUYER
    from tb1
    where BUYER in (select BUYER from tb2)
    and t_n=2)
    ,

    tb4 as (select
    tb2.BUYER,
    avg(timediff('day',first_transaction, second_transaction )) as time_between
    from tb2
    join tb3 on tb2.BUYER=tb3.BUYER
    group by 1),

    tb5 as (select
    BLOCK_TIMESTAMP,
    buyer_address,tx_hash,
    ROW_NUMBER() OVER (partition by buyer_address order by BLOCK_TIMESTAMP) as t_n
    from ethereum.core.ez_nft_sales where block_timestamp >= '2022-01-01'
    ),

    Run a query to Download Data