with 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 'Changed Vote From ' || t1.description || ' To ' || t2.description as changing,
count (distinct t1.voter) as Voters_Count
from firstvotes t1 join secondvotes t2 on t1.voter = t2.voter and t1.description != t2.description and t2.block_timestamp > t1.block_timestamp
group by 1
order by 2 desc