select t3.tag,t4.answer_cnt from( select tag, count(start_time) answer_cnt from examination_info t1 left join exam_record t2 on t1.exam_id = t2.exam_id group by tag having answer_cnt < 3) t3 left join ( select tag,count(start_time) answer_cnt from examination_info t1 left join exam_record t2 on t1.exam_id = t2.exam_id group by tag ) t4 on upper(t3.tag) = t4.tag where t3.answer_cnt!= t4.answer_cnt and t4.answer_cnt >0
题目描述的比较乱,建议一步一步来,先挑选出小于3的,再将其和大写的表进行链接。