binhachonUntitled Query
    Updated 2022-05-07
    with tx_from as (
    select
    block_timestamp,
    'Active user' as symbol,
    value as user_address
    from terra.transactions,
    lateral flatten (input => tx_from)
    --where tx_id = '625A7FCB6AAB442E08C065AE701C4580FB6F9DA1CB446A193523185AD005EA66'
    ),
    tx_to as (
    select
    block_timestamp,
    'Passive user' as symbol,
    value as user_address
    from terra.transactions,
    lateral flatten (input => tx_to)
    --where tx_id = '625A7FCB6AAB442E08C065AE701C4580FB6F9DA1CB446A193523185AD005EA66'
    ),
    total as (
    select
    *
    from tx_from
    union
    select
    *
    from tx_to
    )
    select
    date_trunc('day', block_timestamp) as time,
    symbol,
    count(distinct user_address) as number_of_users
    from total
    group by 1, 2
    Run a query to Download Data