表aInvid spec colorid sizeid1 1 1 2
1 2 3 4表bInvid spec colorid sizeid fQty
1 1 1 2 50
1 2 3 4 60
1 2 4 8 90要的结果是1 2 4 8 90也就是B表在A表中没有的记录(条件是:Invid,spec,colorid,sizeid 同时相等)
1 2 3 4表bInvid spec colorid sizeid fQty
1 1 1 2 50
1 2 3 4 60
1 2 4 8 90要的结果是1 2 4 8 90也就是B表在A表中没有的记录(条件是:Invid,spec,colorid,sizeid 同时相等)
(select 1 from ta where Invid=a.Invid and spec=a.spec and colorid=a.colorid and sizeid=a.sizeid )
select * from tb b
where not exists(select * from ta where Invid=b.Invid and spec=b.spec and colorid=b.colorid and sizeid=b.sizeid)
not exists
(select 1 from ta where
Invid=a.Invid and
spec=a.spec and
colorid=a.colorid and
sizeid=a.sizeid )