ValiMohammadiUntitled Query
    Updated 2022-12-13
    with prop_82 as (select tx_id
    from cosmos.core.fact_msg_attributes
    where
    attribute_key = 'proposal_id' and
    attribute_value = '82' and
    tx_succeeded = 'TRUE'),
    votesoptiontable as (
    select
    block_timestamp,
    tx_id,
    try_parse_json (attribute_value) as data,
    data:option as vote_option,
    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'
    end as vote_type
    from cosmos.core.fact_msg_attributes
    where
    attribute_key= 'option' and
    data:option is not null and
    tx_id in (select tx_id from prop_82) and
    tx_succeeded = 'TRUE')

    select
    vote_type,
    count(distinct t.tx_id) as vote_count,
    count(distinct tx_from) as unique_voter
    from cosmos.core.fact_transactions t join votesoptiontable v on t.tx_id = v.tx_id
    group by 1
    Run a query to Download Data