boomer77voting
    Updated 2021-10-13
    with vote as (select voter, count(distinct tx_id) as votes
    from terra.gov_vote
    group by 1
    order by 2 desc),

    holding as (select address, sum(balance) as LUNA_holding
    from terra.daily_balances
    where currency = 'LUNA' and address in (select voter from vote) and date = CURRENT_DATE
    group by 1)

    select a.voter, a.votes, b.LUNA_holding, CASE
    when b.LUNA_holding > 10000 then 'WHALE'
    else 'RETAIL' end as WHALE_RETAIL
    from vote a
    join holding b on a.voter = b.address
    order by 2 desc
    Run a query to Download Data