update b 
   set (col1, col2)=(select col1,col2 
                       from a
                      where a.key=b.key and a.col1<>b.col2)

解决方案 »

  1.   

    update b set col1=a.col1,col2=a.col2 from a
     where a.key=b.key and a.col1<>b.col2;
      

  2.   

    KingSunSha(弱水三千) 写得没错。如果不会更新,可能是你的 where 子句在 a表中找不到记录。呵呵select * from b where exists (select * from a where a.key=b.key and a.col1<>b.col2)
    看看有没记录。
      

  3.   

    zhuzhichao(竹之草)(出关了…)的在sql server 中可以。但在oracle 嘿嘿
      

  4.   

    Francky說的是沒錯.
    Oracle的update後面不能有from所以Oracle還是用弱水的方法比較好.