oracle与mssql语法差异 2.update from

case 2. update from
 
tablea
(
  cola int,
  colb varchar(20),
  colc varchar(50)
)
 
tableb
(
  col1 int ,
  col2 varchar(20) ,
  col3 varchar(50)
)
 
现在要根据tableb修改tablea数据。
 
在mssql中语法:
update tablea
   colb = b.col2 , colc=b.col3
from tablea a ,tableb b
where a.cola = b.col1
 
在oracle语法:
update tablea
set (colb,colc)= (select col2,col3 from tableb where b.col1= a.cola )
where exists(
          select 1 from tableb where b.col1=a.cola )
原文地址:https://www.cnblogs.com/cxd4321/p/1075122.html