Skip to content

Instantly share code, notes, and snippets.

@remcotolsma
Last active January 2, 2016 12:09
Show Gist options
  • Save remcotolsma/8301328 to your computer and use it in GitHub Desktop.
Save remcotolsma/8301328 to your computer and use it in GitHub Desktop.
WP-Poll vote count distinct IP.
SELECT
vote.pollip_qid,
vote.pollip_aid,
answer.polla_answers,
COUNT( DISTINCT vote.pollip_ip )
FROM
wp_pollsa AS answer
LEFT JOIN
wp_pollsip AS vote
ON answer.polla_aid = vote.pollip_aid
WHERE
vote.pollip_qid = 3
GROUP BY
vote.pollip_aid
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment