update a set a.变动原因=(select 迁移原因 from b where A.编号=B.编号)
where exists(SELECT 1 from b where A.编号=B.编号);

解决方案 »

  1.   

    UPDATE B SET 迁移原因 = (SELECT 变动原因 FROM A WHERE A.编号=B.编号 )
      

  2.   

    update b set b.迁移原因=(select 变动原因 from a where A.编号=B.编号)
    where exists(SELECT 1 from a where A.编号=B.编号);
      

  3.   

    update B set B.迁移原因 = (select 变动原因 from A where A.编号=B.编号)
      

  4.   

    select 变动原因 
    into:B.迁移原因  
    from A
    where A.编号=B.编号这样写可不可以?????
      

  5.   

    呵呵,来迟了.
    select 变动原因 
    into:B.迁移原因  
    from A
    where A.编号=B.编号
    当然如可以。人家要的是更新,不是追加新的纪录。呵呵
      

  6.   

    update B set B.迁移原因=(select A.变动原因 from A where A.编号=B.编号)
    where B.编号 in(select B.编号 from A, B where A.编号=B.编号);
    加了where条件后,将只更新A.编号=B.编号的记录