select s1.class,s1.`name`,s1.score from sc s1 where ( SELECT COUNT(1) FROM sc s2 where s1.class=s2.class AND s2.score >= s1.score )<=3 GROUP BY s1.class,s1.score DESC; sc表 查询结果