通过代码

select 
    a.tag  tag,
    b.answer_cnt  answer_cnt
from(
select 
    tag,
    count(start_time)  answer_cnt
from 
    exam_record e_r  
join
    examination_info e_i
on 
    e_r.exam_id = e_i.exam_id
group by 
    tag
) a 
join(
select 
    tag,
    count(start_time) as answer_cnt
from 
    exam_record e_r 
join 
    examination_info e_i
on 
    e_r.exam_id = e_i.exam_id
group by 
    tag
) b 
on 
    a.tag != b.tag 
and 
    upper(a.tag) = b.tag
and 
    a.answer_cnt < 3

emm没啥说的先对题上的表内连接把tag连上,

然后对生成表进行一个等值自连接,筛选出符合条件的tag完事。