a 表idcard
name
numb表
idcard
num把b表的num 等于a表的num 
条件是a.idcard=b.idcard怎么写呢

解决方案 »

  1.   

    你是要这个?update b set b.num=(select a.num from a where a.idcard=b.idcard)
      

  2.   

    说实话“把b表的num 等于a表的num ”
    这句话我没有看明白,你的意思是要在idcard相同时用A表NUM覆盖b表的num吗?
    若是的话,楼上的就行
    update b set b.num=(select a.num from a where a.idcard=b.idcard)
      

  3.   

    update b set a.num =a.num
    from a 
    where a.idcard=b.idcard,你试下,这是sqlserver,oracle应该差不多吧
      

  4.   

    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;