syntax error

user

New member
Local time
Today, 15:32
Joined
Aug 8, 2009
Messages
2
hi all,
i am trying to run this query:

SELECT b.subject_name,
a.first_name,
a.last_name
FROM subjects b LEFT JOIN students_subjects c ON b.subject_id = c.subject_id LEFT JOIN
students a ON c.student_id = a.student_id


but getting this error message:
"syntax error (missing operator)".
i can't find the problem.
i'm using access 2003.
pleaes help,
thank's.





 
Hello and Welcome!

Did you try enclosing your first LEFT JOIN clause in parentheses?

FROM subjects b LEFT JOIN (students_subjects c ON b.subject_id = c.subject_id) LEFT JOIN
students a ON c.student_id = a.student_id


And of course, the semicolon should close your entire SQL statement

HTH,
John
 
hi,
it worked like this:

SELECT b.subject_name, a.first_name, a.last_name
FROM (subjects b LEFT JOIN students_subjects c ON
b.subject_id=c.subject_id) LEFT JOIN
students a ON c.student_id=a.student_id
ORDER BY b.subject_name;

thank's for your help, it was very helpful for me :).
 
You're welcome, and thanks for posting back your solution - I was taking a shot in the dark with the parentheses, but I know Access is fussy about them with the joins :)
 

Users who are viewing this thread

Back
Top Bottom