mlhUntitled Query
    Updated 2022-07-10
    with stake as
    (with st as
    (with del as
    (select DELEGATOR_ADDRESS, sum(amount)/10e5 as del_vol
    from osmosis.core.fact_staking
    where currency='uosmo' and action='delegate'
    group by 1
    order by 1
    ),

    undel as (
    select DELEGATOR_ADDRESS, sum(amount)/10e5 as undel_vol
    from osmosis.core.fact_staking
    where currency='uosmo'
    and action='undelegate'
    group by 1
    order by 1
    )

    select del.DELEGATOR_ADDRESS as staker,
    undel_vol,
    del_vol,
    undel_vol-del_vol as bal
    from del inner join undel on del.DELEGATOR_ADDRESS=undel.DELEGATOR_ADDRESS
    )

    select staker,
    bal,
    case when bal>0 then 'Positive Staking Balance'
    else ' Zero Staking Balance'
    end as st_bal
    from st),

    pool as (
    with a as
    (with inx as
    Run a query to Download Data