0-MIDATOM Balance Share by voting Type on Voters Wallet
    Updated 2023-01-21
    with tab1 as (
    select
    VOTER
    ,case
    when VOTE_OPTION=1 then 'YES'
    when VOTE_OPTION=2 then 'ABSTAIN'
    when VOTE_OPTION=3 then 'NO WITH VETO'
    when VOTE_OPTION=4 then 'NO' end as voting_type
    from osmosis.core.fact_governance_votes
    where PROPOSAL_ID=394
    and TX_SUCCEEDED='TRUE'),
    tab2 as (
    select ADDRESS,BALANCE
    , case
    when BALANCE/pow(10,decimal)>0 and BALANCE/pow(10,decimal)<5 then 'below 5 ATOM'
    when BALANCE/pow(10,decimal)>=5 and BALANCE/pow(10,decimal)<10 then '5 ~ 10 ATOM'
    when BALANCE/pow(10,decimal)>=10 and BALANCE/pow(10,decimal)<50 then '10 ~ 50 ATOM'
    when BALANCE/pow(10,decimal)>=50 and BALANCE/pow(10,decimal)<100 then '50 ~ 100 ATOM'
    when BALANCE/pow(10,decimal)>=100 then 'Up To 100 ATOM' end as dis_atom
    from osmosis.core.fact_daily_balances
    where DATE=(select max(date)from osmosis.core.fact_daily_balances)
    and CURRENCY='ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2')
    select voting_type,dis_atom,count(distinct ADDRESS)
    from tab1
    left join tab2
    on tab1.VOTER=tab2.ADDRESS
    where dis_atom is not null
    group by 1,2
    order by 3 desc
    Run a query to Download Data