写一个SQL: student(Sno, Sname, classId, grade )查出每个班成绩前三名的同学

SELECT * FROM student stu WHERE (
    SELECT COUNT(*) FROM student 
    WHERE stu.classid=classid AND stu.grade >= grade 
    GROUP BY classid HAVING COUNT(*)<=3
)

posted on 2021-01-08 15:11  沉淀物  阅读(647)  评论(0编辑  收藏  举报

导航