你是要这个?update b set b.num=(select a.num from a where a.idcard=b.idcard)
说实话“把b表的num 等于a表的num ” 这句话我没有看明白,你的意思是要在idcard相同时用A表NUM覆盖b表的num吗? 若是的话,楼上的就行 update b set b.num=(select a.num from a where a.idcard=b.idcard)
update b set a.num =a.num from a where a.idcard=b.idcard,你试下,这是sqlserver,oracle应该差不多吧
update tabB b set b.num = (select num from tabA a where a.idcard = b.idcard) where exists (select 1 from taba a, tabB b where a.idcard = b.idcard); commit;
这句话我没有看明白,你的意思是要在idcard相同时用A表NUM覆盖b表的num吗?
若是的话,楼上的就行
update b set b.num=(select a.num from a where a.idcard=b.idcard)
from a
where a.idcard=b.idcard,你试下,这是sqlserver,oracle应该差不多吧
set b.num = (select num from tabA a where a.idcard = b.idcard)
where exists (select 1 from taba a, tabB b where a.idcard = b.idcard);
commit;