Hiya,
bear with me here...
I have four tables:
Student
student_id
fName
sName
Course
course_id
title
Course_Student
course_id
student_id
Mark
student_id
assignment_id
mark
Mark is a table containing the marks students have got for various assignments they have been set; each student will have several entries in it.
I'm trying to populate a list on a form like this:
student_id | fName | sName | <assign 1 mark> | <assign 2 mark> | ... | <assign n mark>
So far, I've put together the following query to pull the relevent students out of my database:
SELECT student.student_id, student.fName, student.sName
FROM student
INNER JOIN course_student
ON student.stuudent_id = course_student.student_id
WHERE course_student.course_id = 1;
where my course id would be 1 (I'm actually passing this in from a combobox on the form).
I'm not entirely sure how to get my query to pull out the marks for each assignment, but I thought I'd try this for starters:
SELECT student.student_id, student.fName, student.sName, mark.mark
FROM student
LEFT JOIN mark
ON student.student_id = mark.student_id
INNER JOIN course_student
ON student.stuudent_id = course_student.student_id
WHERE course_student.course_id = 1;
but, no matter how I try and word this, Access keeps throwing a syntax error: Missing operator in query expression 'student.student_id = mark.student_id INNER JOIN course_student ON student.student_id = course_student.student_id'.
So, here's my question, then; why is this throwing a syntax error?
Here's a second question, in case anybody's feeling very helpful; how can I populate my list with what I want in it?
Many thanks for reading all of this
Paul
bear with me here...
I have four tables:
Student
student_id
fName
sName
Course
course_id
title
Course_Student
course_id
student_id
Mark
student_id
assignment_id
mark
Mark is a table containing the marks students have got for various assignments they have been set; each student will have several entries in it.
I'm trying to populate a list on a form like this:
student_id | fName | sName | <assign 1 mark> | <assign 2 mark> | ... | <assign n mark>
So far, I've put together the following query to pull the relevent students out of my database:
SELECT student.student_id, student.fName, student.sName
FROM student
INNER JOIN course_student
ON student.stuudent_id = course_student.student_id
WHERE course_student.course_id = 1;
where my course id would be 1 (I'm actually passing this in from a combobox on the form).
I'm not entirely sure how to get my query to pull out the marks for each assignment, but I thought I'd try this for starters:
SELECT student.student_id, student.fName, student.sName, mark.mark
FROM student
LEFT JOIN mark
ON student.student_id = mark.student_id
INNER JOIN course_student
ON student.stuudent_id = course_student.student_id
WHERE course_student.course_id = 1;
but, no matter how I try and word this, Access keeps throwing a syntax error: Missing operator in query expression 'student.student_id = mark.student_id INNER JOIN course_student ON student.student_id = course_student.student_id'.
So, here's my question, then; why is this throwing a syntax error?
Here's a second question, in case anybody's feeling very helpful; how can I populate my list with what I want in it?
Many thanks for reading all of this
Paul