B 是A的真子集,现在想用SQL语句,把A中不含B的选出来,我这样写,成功!
Select * From A Where not Exists (Select * From B Where B.税号 = A.税号)
现在想用B来更新A ,我这样写,失败!
update A
set 备注=已注销
where exists (select * from B where B.税号 = A.税号)
麻烦高手给解答一下,为什么查询成功,更新就失败啊,如果是DELETE呢?我是初学者,不太懂!
update a set 备注=已注销 where dcount("*","b","税号=" & a.税号 & "")>0
这里假定税号是字符字段,还假定你是用 ACCESS 环境
关于此主题请参考:
新手来看:Access的特点、概念。什么是纯 ACCESS 环境?《其他》
http://access911.net/index.asp?u1=a&u2=79FAB51E12DC
试试:
update A
set 备注=已注销
where 税号 not in(select 税号 from B )