MLDZMNOGB10
    Updated 2022-11-24
    with tbt as (select
    label,
    raw_metadata[0]:"account_address" as validators
    from osmosis.core.dim_labels
    where label_subtype ilike 'validator'),
    tb1 as (select
    voter,
    block_timestamp,
    tx_id,
    Description
    from osmosis.core.fact_governance_votes a
    left join osmosis.core.dim_vote_options b on a.vote_option = b.vote_id
    where proposal_id ='362'
    and tx_status = 'SUCCEEDED'),

    tb2 as (select
    distinct a.voter,
    a.block_timestamp,
    a.tx_id,
    b.Description
    from osmosis.core.fact_governance_votes a left join osmosis.core.dim_vote_options b on a.vote_option = b.vote_id
    join tb1 c on a.voter = c.voter and b.description <> c.description and a.block_timestamp > c.block_timestamp
    where proposal_id ='362'
    and tx_status = 'SUCCEEDED')

    select
    case
    when voter in (select voter from tb2) then 'Switch Vote'
    else 'Remain as same Vote'
    end as voters_type,
    case
    when voter in(select validators from tbt) then 'Validators'
    else 'Ordinary voters' end as gp,
    count (distinct voter) as no_voters
    from tb1
    Run a query to Download Data