我有 4 张桌子
Class(ID,Name)
Month(ID,Name)
Student(ID,Name)
Examination(ID,Student,Class,Month,TotalMarks,ObtainedMarks)
这些列student,class,month
已作为Examination
表中的参考。
我想从Examination
表中选择记录order by ObtanedMarks and Group by Class
我使用了以下 SQL 查询
SELECT Months.Name, Class.Name AS Classname, Students.Name AS Studentname, Examination.*
FROM Class INNER JOIN
Examination ON Class.ID = Examination.Class INNER JOIN
Months ON Examination.Month = Months.ID INNER JOIN
Students ON Examination.Student = Students.ID
order by Obtained desc Group by Class.Name
但查询对我不起作用。