select zn=2 as zn, substring_index(line,'-',1) as r,
sum(if(dove=1,1,0)) as line_a,
sum(if(dove=2,1,0)) as line_b,
count(substring_index(line,'-',1)) as q from (
select NULL as zn , NULL as wtf, line, 1 as dove from dotable_b
union all
select zn, zn=2 as wtf, line_mt, 2 as dove from dotable_a
) as tab
group by r
having q > 3
order by q desc
If I write in the forum is because they want to learn.
But they may not understand the suggestions.
This is my big work, I’am sorry but I need only help in this forum.
The point of that exercise was to make obvious why you don’t want to “select zn=2”. That you don’t attempt to interpret the results at all means you aren’t trying to learn.