Multiple Table Joins

Apr 16 2006 1:02 PM
I have the following code which works fine for me in MySql, but retrieves no tuples in SQL Server 2005. I am dealing with three tables. I want to retrieve information on students, their modules, exam marks gained in that module and a sum of marks gained in all continuos assessments of that module. So for every module that the student does, the various continuos assessments that he/she did in that module, will be added up against the module. Any help?

SELECT s.id, f.moduleid, f.exammark, SUM(c.mark) from students s
LEFT JOIN finalexamtab f
ON s.id = f.studentid
INNER JOIN contassessment c
ON s.id = c.studentid and f.moduleid = c.moduleid
WHERE s.major = 'CASE4'
GROUP BY s.id, f.moduleid, f.exammark;

Answers (1)