题解 | #牛客考试分数(三)#
考试分数(三)
http://www.nowcoder.com/practice/b83f8b0e7e934d95a56c24f047260d91
with sc_rk as ( select id,language_id,score,dense_rank() over(partition by language_id order by score desc) as rk from grade group by id,language_id ) select a.id,name,score from sc_rk a left join language b on a.language_id=b.id where rk<=2 group by a.id,name order by name,score desc,id