select
event_inputs:proposalId as ProposalNumber,
sum(case when event_inputs:support::string = 1 then event_inputs:votes else 0 end) as Yes_votes,
sum(case when event_inputs:support::string = 0 then event_inputs:votes else 0 end) as No_votes
from ethereum.core.fact_event_logs
where lower(contract_address) = lower('0x5d2C31ce16924C2a71D317e5BbFd5ce387854039') and event_name = 'VoteCast'
group by ProposalNumber
select