update tableA,tableB set tableA.aa=tableB.bb where tableA.cc=tableB.dd
谢谢!

解决方案 »

  1.   

    如果两个表的对应关系为1对1或多对1,则用如下语句:update tableA
    set
        tableA.aa=(select bb from tableB where dd=tableA.cc)
    from
        tableA 
    where
        exists(select * from tableB where dd=tableA.cc)
      

  2.   

    因为是在SQLSERVER中可以执行所以直接
    update tableA t
    set
        t.aa=(select tt.bb from tableB tt where tt.dd=t.cc)
    就可以了