Updated 2022-11-23
    with validatorst as (
    select address as validator_address,
    label as validator_name,
    raw_metadata[0]['account_address']::string as Account_Address,
    raw_metadata[0]['rank']::string as Rank,
    raw_metadata[0]['uptime']['address']::string as Proposer
    from osmosis.core.dim_labels
    where label_subtype = 'validator'),

    firstvotes as (
    select voter,
    block_timestamp,
    tx_id,
    Description
    from osmosis.core.fact_governance_votes t1 join osmosis.core.dim_vote_options t2 on t1.vote_option = t2.vote_id
    where proposal_id in ('362')
    and tx_status = 'SUCCEEDED'),

    secondvotes as (
    select distinct t1.voter,
    t1.block_timestamp,
    t1.tx_id,
    t2.Description
    from osmosis.core.fact_governance_votes t1 join osmosis.core.dim_vote_options t2 on t1.vote_option = t2.vote_id
    join firstvotes t3 on t1.voter = t3.voter and t1.block_timestamp > t3.block_timestamp and t2.description != t3.description
    where proposal_id in ('362')
    and tx_status = 'SUCCEEDED')

    select voter,
    validator_name,
    'Rank #' || Rank as validator_rank,
    count (distinct tx_id) as Votes_Count
    from secondvotes t1 join validatorst t2 on t1.voter = t2.account_address
    group by 1,2,3
    order by 4 desc
    Run a query to Download Data