题解 | #每类试卷得分前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;

全部评论

相关推荐

10-24 13:36
门头沟学院 Java
Zzzzoooo:更新:今天下午有hr联系我去不去客户端,拒了
点赞 评论 收藏
分享
评论
1
收藏
分享
牛客网
牛客企业服务