with tb as (
SELECT
id,
PROPOSAL_TITLE,
VOTER,
VOTE_OPTION[0] as vote,
CHOICES[0] as choice1,
CHOICES[1] as choice2,
CHOICES[2] as choice3,
CHOICES[3] as choice4
FROM ethereum.core.ez_snapshot
where space_id='arbitrum-odyssey.eth'
)
SELECT
PROPOSAL_TITLE,
choice1,
choice2,
choice3,
choice4,
case when vote = '1' then choice1
when vote = '2' then choice2
when vote = '3' then choice3
when vote = '4' then choice4
end as user_choice,
count(distinct VOTER) as "Number of Votes"
from tb
where vote != '0'
and PROPOSAL_TITLE = 'Arbitrum Odyssey Poll 6'
group by 1,2,3,4,5,6
order by 7 desc