求个sql???
A表3个字段(a1,a2,a3)
a1 a2 a3
n1 n11 n12
n2 n21 n22
n3 n31 n32
B表有3个字段
b1 b2 b3
n1 n11 n12
求解如下结果:
a1 a2 a3
n2 n21 n22
n3 n31 n32
也就是求的A表中不在B表的数据(必须a1,a2,a3同时相等)
------解决方案--------------------
select * from A with(nolock)
where not exists(
select top(1)1 from B with(nolock)
where A.a1=B.a1 and
A.b2=B.a2 and
A.a3=B.a3
)