HosseinUntitled Query
    Updated 2022-12-12
    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