HosseinUntitled Query
Updated 2022-12-12
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
tbl0 as (
select block_timestamp,
tx_id,
a.attribute_value as voter,
try_parse_json (c.attribute_value) as metadata,
metadata:option as vote_option,
case vote_option
when '1' then 'Yes'
when '2' then 'Abstain'
when '3' then 'No'
when '4' then 'No With Veto'
end as vote_value
from cosmos.core.fact_msg_attributes a
join cosmos.core.fact_msg_attributes b
using(tx_id)
join cosmos.core.fact_msg_attributes c
using(tx_id)
where a.attribute_key = 'spender'
and b.attribute_key = 'proposal_id'
and b.attribute_value = '82'
and c.attribute_key = 'option'
and a.tx_succeeded = 1
),
tbl1 as (
select voter,
min (block_timestamp) as min_date,
tx_id,
vote_option
from tbl0
group by voter, tx_id, vote_option
),
tbl2 as (
select voter,
Run a query to Download Data