Hi;
I thought this would be simple but I am quite mystified right now.
Say I've got a list of student IDs in one table. (STUDENTS)
Then I've got some testing records in another (PROTOCOLS)
I want to show the complete student list, and also see the testing data for those students who have been tested (leave the data columns blank for the other kids)
Now, I do need some filtering of the data as there are various test types and phases that I want to limit the query on.
I have been trying all kinds of joins all day and ...bupkis.
Here is basically what I need:
SELECT
STUDENTS.studentID,
PROTOCOLID
FROM STUDENTS
LEFT JOIN PROTOCOLS ON STUDENTS.studentID=PROTOCOLS.studentID
WHERE
PROTOCOLS.COLLAPSE='FALL' AND
PROTOCOLS.TEST='PALS' AND
PROTOCOLS.TESTPHASE LIKE 'J%'
GROUP BY studentID, PROTOCOLS.PROTOCOLID
ORDER BY studentID
This works except for the fact that the rows where PROTOCOLID should be empty (null) simply do not show up at all. I only get rows where data actually exists in the PROTOCOLS table.
I have not worked with subqueries and am not clear on use of the HAVING syntax. Would these apply to this problem?
Thanks.