回复:how to deal exist? 不搞的这么复杂

来源: 2013-03-05 20:21:46 [旧帖] [给我悄悄话] 本文已被阅读:

select * from tableA
union
select * from tableB
where not exists(select * from tableA where pk = tableB.pk)

or

select * from tableA
union
select * from tableB
where pk not in (select pk from tableA)

or use union all