update a set a.n1=(select b.n1 from b where a.gh=b.gh);

解决方案 »

  1.   

    update a set a.n1 = (select b.n1 from b where a.gh = b.gh) where ...
      

  2.   

    update a set a.n1=(select b.n1 from b where a.gh=b.gh) is wrong;update a set a.n1 = (select b.n1 from b where a.gh = b.gh) where ... is wrong too;because (select b.n1 from b where a.gh=b.gh) may return multi records.
      

  3.   

    你这又不是一对一的数据关系,是你的数据根本就不对,不是人家的SQL不对。
    一个工号还能有多个人名与之对应?
      

  4.   

    to kingman888(国王) : I am not 楼主, but thanks, for you are right.
    if gh in a and b are both primary key, these sql are right, if not, they are wrong.
    I am not sure so I was confused,I am wrong.