题解 | #作答试卷得分大于过80的人的用户等级分布#
作答试卷得分大于过80的人的用户等级分布
http://www.nowcoder.com/practice/5bc77e3a3c374ad6a92798f0ead4c744
- SELECT level , count(distinct uid) as level_cnt
- FROM user_info
- WHERE uid IN
- (SELECT uid
- FROM examination_info ei LEFT JOIN exam_record er ON ei.exam_id = er.exam_id
- WHERE tag = 'SQL' AND score > 80)
- GROUP BY level
- ORDER BY level_cnt DESC , level DESC