任何人都可以更正这个查询吗?我只是不知道如何使它工作。
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