我想要将A表中的字段1根据外键设置为与B表中的字段2相同
update A B set A.字段1=B.字段2 where A.BID=B.ID

解决方案 »

  1.   

    这个语句执行的时候会报 missing set keyword  要怎么弄啊?
      

  2.   

    UPDATE只能更新一张表,不能同时更新A B,两张表。
      

  3.   

    分送你了..
    自己搞定了...
    update A set A.字段1=(select B.字段2 from B where A.BID=B.ID)
      

  4.   

    update A set A.字段1=(select B.字段2 from B where B.ID=A.ID)
    where exists(select 1 from B where B.ID=A.ID)
    但是要确保select B.字段2 from B where B.ID=A.ID只能抓到唯一的B.字段2