Afonso_DiazUntitled Query
    Updated 2023-01-29
    with t1 as (
    select
    purchaser as user,
    mint,
    min(block_timestamp)::date as buy_date
    from solana.core.fact_nft_sales
    where marketplace = 'exchange art'
    and succeeded = 1
    group by 1, 2
    ),

    t2 as (
    select
    seller as user,
    mint,
    min(block_timestamp)::date as sell_date
    from solana.core.fact_nft_sales t2
    where marketplace = 'exchange art'
    and exists (select * from t1 where t1.user = t2.seller)
    and exists (select * from t1 where t1.mint = t2.mint)
    and succeeded = 1
    group by 1, 2
    ),

    t3 as (
    select
    user,
    datediff (day, buy_date, sell_date) as holded_time,
    mint
    from t1 join t2
    using(mint, user)
    )

    select
    avg (holded_time) as average_holded_time
    from t3
    Run a query to Download Data