Pmisha-bmlMdxsupply.year
    Updated 2022-05-10
    with t1 as (select
    date as dt1,
    sum(balance) as TotalSupply,
    count(distinct address) as unique_address
    from terra.daily_balances
    where date >= CURRENT_DATE - interval '365 days'
    and currency = 'LUNA'
    group by 1
    order by 1),

    t2 as (select
    date as dt2,
    sum(balance) as non_CirculatingSupply,
    count(distinct address) as unique_address
    from terra.daily_balances
    where date >= CURRENT_DATE - interval '365 days'
    and currency = 'LUNA'
    and address_label_type is not NULL
    group by 1
    order by 1)

    select
    t1.dt1 as dt,
    TotalSupply,
    non_CirculatingSupply
    from t1
    inner join t2 on t1.dt1=t2.dt2
    Run a query to Download Data