--查询两张具有相同数据库结构的表里相或的记录
SELECT a.*
FROM
TableA a,TableB b
WHERE
a.id not in (SELECT bb.id FROM TableB bb)
OR
b.id NOT IN (SELECT aa.id FROM TableA aa)
UNION ALL
SELECT b.*
FROM
TableB b
WHERE
b.id NOT IN (SELECT aa.id FROM TableA aa)
SELECT a.*
FROM
TableA a,TableB b
WHERE
a.id not in (SELECT bb.id FROM TableB bb)
OR
b.id NOT IN (SELECT aa.id FROM TableA aa)
UNION ALL
SELECT b.*
FROM
TableB b
WHERE
b.id NOT IN (SELECT aa.id FROM TableA aa)