题解 | #大小写混乱时的筛选统计#
大小写混乱时的筛选统计
http://www.nowcoder.com/practice/81cb12931a604811ae69d332515c7734
要用满足完成数小于3的小写tag去匹配对应大写tag的数量!!!醉了
select t1.tag,t2.answer_cnt from ( select tag from exam_record t1 join examination_info t2 on t1.exam_id = t2.exam_id where upper(tag) <> tag group by tag having count(1) < 3 ) t1 join ( select tag,count(1) as answer_cnt from exam_record t1 join examination_info t2 on t1.exam_id = t2.exam_id group by tag ) t2 on upper(t1.tag) = t2.tag order by answer_cnt desc