adambalaUntitled Query
    Updated 2022-12-07
    with

    first_tx as (

    select

    tx_from,
    min(block_timestamp)::date as date_first

    from terra.classic.fact_transactions txs
    where tx_status = 'SUCCEEDED'
    and exists (select 1 from terra.classic.fact_transactions txs_tf
    where tx_status = 'SUCCEEDED'
    and block_timestamp > date('2022-05-12') - interval '90 days'
    and block_id <= 7603700
    and txs_tf.tx_from = txs.tx_from
    )
    group by 1
    ),
    txs_classic as (

    select

    date_trunc('week',block_timestamp) as date,
    case
    when date = date_first then 'NEW'
    else 'EXISTING'
    end as label,

    count(distinct tx_from) as users

    from terra.classic.fact_transactions txs
    left join first_tx
    using (tx_from)
    where tx_status = 'SUCCEEDED'
    Run a query to Download Data