番茄的梦想

那一抹夕阳

  博客园  :: 首页  ::  :: 联系 :: 订阅 订阅  :: 管理
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 )
posted on 2008-02-20 15:22  番茄的梦想  阅读(660)  评论(1编辑  收藏  举报