select * ----在table1但不在table2中
from table1 as t1
where not exists(
select *
from table2 as t2
where t1.f1=t2.f1 and t1.f2=t2.f2 and ....
)
union
select * ----在table2但不在table1中
from table2 as t1
where not exists(
select *
from table1 as t2
where t1.f1=t2.f1 and t1.f2=t2.f2 and ....
)
from table1 as t1
where not exists(
select *
from table2 as t2
where t1.f1=t2.f1 and t1.f2=t2.f2 and ....
)
union
select * ----在table2但不在table1中
from table2 as t1
where not exists(
select *
from table1 as t2
where t1.f1=t2.f1 and t1.f2=t2.f2 and ....
)