with vote as (
select
block_timestamp,
sender,
base64_decode_string(tx_message:txn:note::string) as note,
substr(note, position('[', note, 1)) as vote,
substr(vote, position(',', vote, 1) + 2, 1) as selection,
row_number() over (partition by sender order by block_timestamp desc) as rownumber
from algorand.payment_transaction
where block_timestamp::date > '2022-01-30'
and block_timestamp::date < '2022-03-01'
and receiver = '57QZ4S7YHTWPRAM3DQ2MLNSVLAQB7DTK4D7SUNRIEFMRGOU7DMYFGF55BY'
and amount is null
and try_base64_decode_string(tx_message:txn:note::string) like '%af/gov1:j[5,%'
and selection in ('a', 'b')
qualify rownumber = 1
)
select
selection,
count(sender) as number_of_voters
from vote
group by selection