KaskoazulMonkeDAO - Voting results by SMB number
    Updated 2022-04-05
    WITH SMB AS (
    select signers[0] as voter,
    case instructions[0]:data
    when 'Yjf5DvKUCfa2bPkYz4AiWs' then 'YES'
    when 'Yjf5DvKUCfa2Rh5YBEg7FM' then 'NO'
    end as vote,
    sum(ARRAY_SIZE(inner_instructions)) as votes
    from solana.fact_transactions
    where instructions[0]:accounts[6] = 'BD9XQhU1DXA9V4GLdgTq7xdQY5UBnShfq4caTSEL9Lr'
    and succeeded = 'TRUE'
    and instructions[0]:programId = 'Daovoteq2Y28gJyme6TNUXT9TxXrePiouFuHezkiozci'
    group by 1, 2
    )

    select --voter,
    votes as Number_of_SMB_owned,
    vote,
    count(vote)
    from SMB
    group by 1, 2
    Run a query to Download Data