Faithfulman
Programmer
I am having issues here. I really am lossed on this one.
Similar to a earlier post but different:
TABLE poll_qs
pollId
....
...
..
TABLE poll_ans
pollAId - ID FOR THIS POLL
pollId - ID FOR poll_qs POLL
....
...
TABLE users
userId
firstName
lastName
....
...
I want to user to view how many polls he has not voted on and it to automatically come up with the next poll he needs to vote on. The below only shows me what he has voted on:
So for example, I have 6 polls, and have voted on 5 of them. With the above query, I can see 5 poll answers with my name on them ... but I don't get the poll that I haven't voted on. I would like to see the poll that I haven't voted on and everything else show up as NULL.
Does anyone have any help for me?
Thanks in Advance!
Faithful
Similar to a earlier post but different:
TABLE poll_qs
pollId
....
...
..
TABLE poll_ans
pollAId - ID FOR THIS POLL
pollId - ID FOR poll_qs POLL
....
...
TABLE users
userId
firstName
lastName
....
...
I want to user to view how many polls he has not voted on and it to automatically come up with the next poll he needs to vote on. The below only shows me what he has voted on:
Code:
SELECT poll_qs.pollId, poll_ans.pollAId, users.firstName, users.lastName FROM poll_qs LEFT OUTER JOIN poll_ans ON poll_ans.pollId = poll_qs.pollId LEFT OUTER JOIN users ON poll_ans.userId = users.userId WHERE users.userId = '1'
So for example, I have 6 polls, and have voted on 5 of them. With the above query, I can see 5 poll answers with my name on them ... but I don't get the poll that I haven't voted on. I would like to see the poll that I haven't voted on and everything else show up as NULL.
Does anyone have any help for me?
Thanks in Advance!
Faithful