mattkstewProposal 1
    Updated 2023-01-25
    with tab1 as (
    select
    PROPOSAL_ID,
    count(distinct voter) as Total_Votes

    from terra.core.fact_governance_votes
    group by 1
    order by 2 desc )

    , tab2 as (
    select
    proposal_id,
    message_value:content:description as Proposal
    from terra.core.fact_governance_submit_proposal left outer join terra.core.ez_messages on
    terra.core.fact_governance_submit_proposal.tx_id = terra.core.ez_messages.tx_id
    where proposal_id in (select proposal_id from tab1)
    )

    select
    tab1.proposal_id,
    Proposal,
    Total_Votes


    from tab1 left outer join tab2 on tab1.proposal_id = tab2.proposal_id
    where tab1.proposal_id = 349
    Run a query to Download Data