Jeff Butera <[EMAIL PROTECTED]> writes:
> UPDATE STUDENT_ANSWERS SET CORRECT=QA.CORRECT
> FROM QUESTION_ANSWERS QA,STUDENT_ANSWERS SA
> WHERE SA.CORRECT=null
> AND SA.QUESTIONS_ID=QA.QUESTIONS_ID
> AND SA.ANSWERS_ID=QA.ANSWERS_ID;
What you've got here is a three-way join between QUESTION_ANSWERS and
two instances of STUDENT_ANSWERS (the update target and the SA alias).
I doubt that's what you want. FROM in update should only be used for
*additional* tables. The target table has no alias and must be spelled
out:
UPDATE STUDENT_ANSWERS SET CORRECT=QA.CORRECT
FROM QUESTION_ANSWERS QA
WHERE STUDENT_ANSWERS.CORRECT=null
AND STUDENT_ANSWERS.QUESTIONS_ID=QA.QUESTIONS_ID
AND STUDENT_ANSWERS.ANSWERS_ID=QA.ANSWERS_ID;
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly