|
SELECT answers.answerID, answers.answerLetter,
userAnswers.answerID as userAnswer, answers.correct, answers.feedback,
testQuestions.questionID, testQuestions.question, testQuestions.questionNumber,
answers.answer
FROM answers, userAnswers, testQuestions WHERE answers.answerID = userAnswers.answerID AND userAnswers.memberID = 1 AND testQuestions.questionID = answers.questionID AND testQuestions.testID = 1 AND answers.correct = 1 for
the one user with memberid = 1, you are going to get all of their correct
answers for the testid = 1. I don't see any reason for an outer join. and when
you're putting in that outer join, even though you're putting a where <>
null in the where statement, that is only for the row selection part of the
query, which might or might not knock out some rows, but with the outer join,
you're just going to put nulls right back in, which is why you're seeing nulls,
and I'm betting it's one row of data for each answer to the test, whether they
answered it correctly or not, which would give you a null for userAnswer if they
did not choose that answer.
Bruce Dunwiddie
|
Title: Message
- [KCFusion] SQL question Adaryl Wakefield
- RE: [KCFusion] SQL question hartwichr
- RE: [KCFusion] SQL question Nate Rightmire
- Re: [KCFusion] SQL question Adaryl \"Bob\" Wakefield
- RE: [KCFusion] SQL question Moore, Paul
- Re: [KCFusion] SQL question Adaryl Wakefield
- RE: [KCFusion] SQL questio... Bruce Dunwiddie
- Re: [KCFusion] SQL que... Adaryl Wakefield
- Re: [KCFusion] SQ... Bruce Dunwiddie
- Re: [KCFusion... Adaryl \"Bob\" Wakefield
- Re: [KCFu... Adaryl \"Bob\" Wakefield
- RE: [KCFusion] SQL question Smith, Jim
- Re: [KCFusion] SQL question Adaryl Wakefield
