PDA

View Full Version : SQL Query to select users who have NOT voted


Luke Brown256
15 Mar 2007, 10:46
Hi i am trying to write an SQL query that would select all users from a specific usergroup who have NOT voted in a specific poll:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



that is what i have got so far, but it returns blank results, can anyone assist with this?

Luke Brown

Marco van Herwaarden
15 Mar 2007, 10:53
WHERE vb3_pollvote.userid IS NULL
AND vb3_pollvote.pollid = 240

That will never be true. Either the userid is null (ie. no match) or the pollid has a value, never both at the same time.

Try:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------