题解 | #作答试卷得分大于过80的人的用户等级分布#

作答试卷得分大于过80的人的用户等级分布

http://www.nowcoder.com/practice/5bc77e3a3c374ad6a92798f0ead4c744

嵌套子查询,题目没有说清楚,后面level个数相同时用level进行排序

select level,count(distinct uid) as level_cnt from user_info where uid in (select uid from user_info where uid in (select distinct uid from exam_record where exam_id in (select exam_id from examination_info where tag='SQL') and score >80)) group by level
order by level_cnt desc ,level desc

全部评论

相关推荐

我已成为0offer的糕手:别惯着,胆子都是练出来的,这里认怂了,那以后被裁应届被拖工资还敢抗争?
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务