题解 | #考试分数(三)#
考试分数(三)
https://www.nowcoder.com/practice/b83f8b0e7e934d95a56c24f047260d91
SELECT id, name, score FROM ( SELECT g.id, l.name, score, DENSE_RANK() OVER (PARTITION BY l.name ORDER BY score DESC) AS ranking FROM grade g JOIN language l ON l.id = g.language_id ) AS t WHERE ranking <= 2 ORDER BY name, score DESC, id;