题解 | #每类试卷得分前3名#题目实例解释有问题,按tag和uid分组求最大最小值,再排序就行了

每类试卷得分前3名

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

select * from (
        select tag as tid,uid,row_number()over(partition by tag order by max_score desc,min_score desc,uid desc) as ranking
        from (
                select uid,max(score) as max_score,min(score) as min_score,tag
                from exam_record t1
                join examination_info t3 on t1.exam_id = t3.exam_id
                group by uid,tag
                ) t 
    ) t2
where ranking < 4


全部评论

相关推荐

不愿透露姓名的神秘牛友
06-29 17:30
找实习找着找着就要进入7月了,马上秋招也要开始了,找实习还有意义吗?
绝迹的星:有面就面, 没面上就当日薪4位数大佬免费培训, 面上了再考虑要不要实习
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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