要用满足完成数小于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