alleriaVotes, Votes, Votes
Updated 2022-04-22
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
›
⌄
WITH
latest_tx as (
SELECT
voter as label,
proposal_id,
max(block_timestamp) as latest_timestamp
FROM terra.gov_vote
GROUP BY voter, proposal_id
ORDER BY proposal_id DESC
),
test as (
SELECT
a.proposal_id,
voter_label_subtype,
CASE
WHEN voter_label_subtype = 'validator' THEN voter_label_subtype
WHEN voter_label_subtype is NULL THEN 'retail'
ELSE 'contract_deployer'
END as category,
SUM(voting_power) as total_voting_power
FROM terra.gov_vote a
INNER JOIN latest_tx ON (a.proposal_id = latest_tx.proposal_id AND a.block_timestamp = latest_timestamp)
WHERE (option = 'VOTE_OPTION_YES' OR option = 'YES')
--AND voter_label_subtype != 'contract_deployer'
GROUP BY a.proposal_id, voter_label_subtype
ORDER BY a.proposal_id ASC
)
SELECT
*
FROM terra.gov_vote
WHERE proposal_id = '971'
Run a query to Download Data