MLDZMNOGB13
Updated 2022-11-24Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
with 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'),
tb3 as (select
*
from osmosis.core.fact_governance_votes a left join osmosis.core.dim_vote_options b on a.vote_option = b.vote_id
where tx_status = 'SUCCEEDED'
and proposal_id ='362')
select
case
when address in (select voter from tb2) then 'Switch Vote'
else 'Remain as same Vote' end as gp,
avg (balance/pow(10,6)) as balance_osmo
from osmosis.core.fact_daily_balances
where currency = 'uosmo'
and date = CURRENT_DATE-2
and address in(select voter from tb3)
group by 1
Run a query to Download Data