可以用union,minus (select * from A where 条件1 minus select * from A where 条件2) --这是符合条件1中的单不在条件2的记录 union (select * from A where 条件2 minus select * from A where 条件1) --这是符合条件2的但不在条件1中的记录 呵呵,有点费劲,
xzgyb(回首往事,不堪回首): 你用的是哪个SQL方言?我用SQL SERVER 2000, 好象没有MINUS这个关键字啊!
(select * from A where 条件1 minus
select * from A where 条件2) --这是符合条件1中的单不在条件2的记录
union
(select * from A where 条件2 minus
select * from A where 条件1) --这是符合条件2的但不在条件1中的记录
呵呵,有点费劲,
你用的是哪个SQL方言?我用SQL SERVER 2000,
好象没有MINUS这个关键字啊!
SQL SERVER
没有这种求差集的语句吗