Wednesday, March 28, 2012

Query

Hey

I have a table where i store answers for a questionare

i have the columns id(key), userId, QuestionId, answerID

QuestionID and answerID are related to different tables

one of the users didnt answer Question 6 and the rest of the users did. there is no empty entry for Question 6 so the database skips from Question 5 to Question 7

how do i write a query to find out the userID of the person that didnt answer Question 6

select userId from <questionaretable> where userid not in (select userid from <questionaretable> where questionid = 6)|||

Thx champion

No comments:

Post a Comment