select *
from (
select a1 as f1,a2 as f2,a3 as f3,1 as xh from a
union
select b1 as f1,b2 as f2,b3 as f3,2 as xh from b) T1
where checksum(f1,f2,f3) in
(select checksum(*)
from
(
select a1 as f1,a2 as f2,a3 as f3 from a
union
select b1 as f1,b2 as f2,b3 as f3 from b
) as T2)
order by xh