34,576
社区成员
发帖
与我相关
我的任务
分享
select * from abl t where not exists(select 1 from tbl where a=t.a and b=t.b)
union all
select * from tbl t where not exists(select 1 from abl where a=t.a and b=t.b)
--A表
select * from abl t where not exists(select 1 from tbl where a=t.a and b=t.b)
union all
--B表
select * from tbl t where not exists(select 1 from abl where a=t.a and b=t.b)
select *
from (
select * from abl
except
select * from tbl
) as a
union all
select *
from (
select * from tbl
except
select * from abl
) as b
2005SELECT COUNT(*) FROM A WHERE NOT EXISTS(SELECT 1 FROM B WHERE A.A=B.A AND A.B=B.B)
UNION ALL
SELECT COUNT(*) FROM B WHERE NOT EXISTS(SELECT 1 FROM A WHERE A.A=B.A AND A.B=B.B)
SELECT * FROM A WHERE NOT EXISTS(SELECT 1 FROM B WHERE A.A=B.A AND A.B=B.B)
UNION ALL
SELECT * FROM B WHERE NOT EXISTS(SELECT 1 FROM A WHERE A.A=B.A AND A.B=B.B)
??select * from abl t where not exists(select 1 from tbl where a=t.a and b=t.b)
union all
select * from tbl t where not exists(select 1 from abl where a=t.a and b=t.b)
求ab1中不在tb1的并上tb1中不在ab1中的:
select *
from abl t
where not exists(select 1 from tbl where a=t.a and b=t.b)
union all
select *
from tbl t
where not exists(select 1 from abl where a=t.a and b=t.b)