题解 | #每类试卷得分前3名#

每类试卷得分前3名

https://www.nowcoder.com/practice/255aa1863fe14aa88694c09ebbc1dbca

with data_for_use as (
    select exam_id, tag, uid, score
    from exam_record
    left join examination_info using (exam_id)
    where score is not null
), tag_uid_score as (
    select tag, uid, max(score) mxs, min(score) mis
    from data_for_use
    group by tag, uid
)
select tag as tid, uid, ranking
from (
    select tag, uid, 
        row_number()over(partition by tag order by mxs desc, mis desc, uid desc) as ranking
    from tag_uid_score
    ) a 
where ranking <= 3

全部评论

相关推荐

06-12 17:07
沈阳大学 Java
AAA射频张总:冬天也发扬下,我怕冷
点赞 评论 收藏
分享
点赞 评论 收藏
分享
北漂的牛马人:211佬,包进的,可能是系统问题
点赞 评论 收藏
分享
现在才开始投还有可能吗😭😭😭
牛客621925249号:开秋招了已经
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务