rakhisanjayaUntitled Query
    Updated 2023-01-12
    with table1 as (
    select
    voter as Voter2,
    max(block_timestamp) as final_vote_time
    from cosmos.core.fact_governance_votes
    where proposal_id = {{Proposal_Number_Cosmos}}
    group by 1 )

    , table2 as (
    select
    vote_option

    from table1 left outer join cosmos.core.fact_governance_votes
    on final_vote_time = block_timestamp
    and Voter2 = Voter
    )

    select
    Case
    when vote_option = 1 then 'Yes'
    when vote_option = 2 then 'Abstain'
    when vote_option = 3 then 'NO'
    when vote_option = 4 then 'NO WITH VETO'
    else 'NULL'
    End as Voter_option,
    count(*)


    from table2
    group by 1
    Run a query to Download Data