表1
id name dept表2
id name dept把ID 一样的 表1的DEPT 更新成 表2的DEPT

解决方案 »

  1.   

    update 表1
    set dept = (select dept from 表2 where id=表1.id)
      

  2.   

    update 表1 set dept=表2.dept from 表2 where 表2.id=表1.id
      

  3.   

    子查询返回的值多于一个。当子查询跟随在 =、!=、<、<=、>、>= 之后,或子查询用作表达式时,这种情况是不允许的。
    语句已终止。
      

  4.   

    update 表1 set dept=表2.dept from 表1,表2 where 表2.id=表1.id