elsina2024-09-14: Age wallet
    Updated 2024-11-01
    with t1 as (
    SELECT
    buyer_address as user,
    min(block_timestamp) as min_nft_tx
    from
    base.nft.ez_nft_sales
    group by user
    ),

    t2 as (
    SELECT
    user,
    min_nft_tx,
    min(block_timestamp) as min_tx
    from
    base.core.fact_transactions b left join t1 a on user = from_address
    group by
    user, min_nft_tx
    ),

    t3 as (
    select
    user,
    datediff('day' , min_tx , min_nft_tx) as age_wallets
    from t2
    )
    select
    case
    when age_wallets < 1 then 'A : < 1 days'
    when age_wallets < 10 then 'B : < 1-10 days'
    when age_wallets < 30 then 'C : < 10-30 days'
    when age_wallets < 90 then 'D : < 30-90 days'
    when age_wallets < 180 then 'E : < 90-180 days'
    when age_wallets < 365 then 'F : < 180-365 days'
    else 'G : over 1 year'
    QueryRunArchived: QueryRun has been archived