0xHaM-dSocial Profiles & Wallet's Age
    Updated 2023-06-10
    with createTb as (
    select
    signer_id,
    min(block_timestamp)::date as creation_date
    from near.social.fact_profile_changes
    join near.core.fact_transactions using(tx_hash)
    where tx_status = 'Success'
    group by signer_id
    )
    , monthTb as (
    SELECT
    signer_id,
    monthname(creation_date) as months
    FROM createTb
    WHERE months in ('{{Birthday_Month}}') -- Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
    )
    SELECT
    signer_id as "Account",
    min(block_timestamp)::date as first_tx,
    max(block_timestamp)::date as last_tx,
    datediff('day', first_tx, last_tx) as age_wallet
    FROM near.core.fact_transactions JOIN monthTb on TX_SIGNER = signer_id
    GROUP by 1
    ORDER by 4 DESC


    Run a query to Download Data