任何人都可以更正此查詢嗎? 我只是不知道如何使它工作。聚合函數子查詢
SELECT ClassCourses.ClassID,ClassCourses.CourseID,ClassCourses.MaxMark,Max(SumOFMarks),Min(SumOFMarks)
FROM
(
SELECT ClassCourses.ClassID,ClassCourses.CourseID,ClassCourses.MaxMark,sum(StudentMark)SumOFMarks
FROM Users
INNER JOIN UserExams ON Users.UserID = UserExams.UserID
INNER JOIN Exams ON UserExams.ExamID = Exams.ExamID
INNER JOIN ClassCourses ON Exams.ClassID = ClassCourses.ClassID AND Exams.CourseID = ClassCourses.CourseID
WHERE ClassCourses.ClassID=1
group by ClassCourses.ClassID,ClassCourses.CourseID,ClassCourses.MaxMark
)AS T
將來,如果您還發布表格定義和您看到的錯誤信息,它確實會有所幫助。 –