Select * from Table1 A Where Not Exists(Select * from Table2 Where a=A.a And b=A.b Andc=A.c)
Select * from Table1 A Where Not Exists(Select * from Table2 Where a+b+c=A.a+A.b+A.c)
declare @t table(a int,b int,c int) insert into @t select 1 ,2 ,3 union all select 2 ,3 ,4 union all select 5 ,8 ,5 union all select 8 ,7 ,5declare @a table(a int,b int,c int) insert into @a select 1 ,2 ,3 union all select 2 ,3 ,4select * from @t a where not exists(select 1 from @a where a=a.a and b=a.b and c=a.c)
a b c 1 21 3 2 3 4 5 8 5 8 7 5 a b c 1 2 13 2 3 4 假如是這樣的數據,a+b+c=A.a+A.b+A.c這樣就有問題了。
Where Not Exists(Select * from Table2 Where a=A.a And b=A.b Andc=A.c)
Where Not Exists(Select * from Table2 Where a+b+c=A.a+A.b+A.c)
insert into @t select 1 ,2 ,3
union all select 2 ,3 ,4
union all select 5 ,8 ,5
union all select 8 ,7 ,5declare @a table(a int,b int,c int)
insert into @a select 1 ,2 ,3
union all select 2 ,3 ,4select * from @t a where not exists(select 1 from @a where a=a.a and b=a.b and c=a.c)
1 21 3
2 3 4
5 8 5
8 7 5
a b c
1 2 13
2 3 4
假如是這樣的數據,a+b+c=A.a+A.b+A.c這樣就有問題了。