题解 | #考试分数(三)#
考试分数(三)
http://www.nowcoder.com/practice/b83f8b0e7e934d95a56c24f047260d91
select t1.id,l.name,t1.score
from(
select id,language_id,score,
dense_rank() over(partition by language_id order by score desc) score_rank
> from grade) t1
left join language l
on t1.language_id=l.id
where t1.score_rank<=2
order by l.name,t1.score desc,t1.id;