题解 | #每类试卷得分前3名#
每类试卷得分前3名
https://www.nowcoder.com/practice/255aa1863fe14aa88694c09ebbc1dbca
select tag as tid,uid,ranking
from (
select
tag,
uid,
row_number() over(
partition by tag
order by tag, max(score) desc ,min(score) desc ,uid desc
) ranking
from examination_info t1
inner join exam_record t2
on t1.exam_id = t2.exam_id
group by tag,uid
) t
where ranking <= 3;
查看8道真题和解析

