5 messages in com.mysql.lists.win32Re: Help out a newbie| From | Sent On | Attachments |
|---|---|---|
| Douglas Otwell | 22 Feb 2002 07:55 | |
| Peter | 22 Feb 2002 08:41 | |
| Douglas Otwell | 22 Feb 2002 11:46 | |
| Peter | 22 Feb 2002 17:38 | |
| Joel Nelson | 22 Feb 2002 19:16 |
| Subject: | Re: Help out a newbie![]() |
|---|---|
| From: | Douglas Otwell (dko6...@yahoo.com) |
| Date: | 02/22/2002 11:46:28 AM |
| List: | com.mysql.lists.win32 |
I'm sorry, I wasn't clear. I want results only for a single student, say studentID = 2. But if I put that in the WHERE clause in your example, I won't get results for quizes NOT taken by #2, because somebody else DID take that quiz. See my dilemma?
----- Original Message ----- From: "Peter" <pw...@post4.tele.dk> To: "Douglas Otwell" <dko6...@yahoo.com>; <win...@lists.mysql.com> Sent: Friday, February 22, 2002 10:41 AM Subject: Re: Help out a newbie
Hi
SELECT student.studentID, student.studentname, quiz.quizID, quiz.answ1, quiz.answ2 FROM student LEFT JOIN quiz ON (studentID = quizID) ORDER BY student.studentID
... give You all fields availbale without temp. tables.
Best regards Peter
----- Original Message ----- From: "Douglas Otwell" <dko6...@yahoo.com> To: <win...@lists.mysql.com> Sent: Friday, February 22, 2002 4:56 PM Subject: Help out a newbie
Ok, this may be a general SQL question. I need to do a left-outer join
on
a
table and a dynamic query. For example, I have a "quiz" table, and an "answer" table containing quiz answers for all students. I need a result set containing every row in "quiz" with answers for a specific student, with nulls for quizes that the student has not taken yet. I guess I could create a temporary table "SELECT * FROM answers WHERE answers.student = somebody" and then left-outer join that temporary table with "quizes", but I was wondering if there were a more efficient/elegant way to do this.
Thanks for any help, Douglas
--------------------------------------------------------------------- Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before posting. To request this thread, e-mail win3...@lists.mysql.com
To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail win3...@lists.mysql.com instead.




