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 )

相关文章:

  • 2022-12-23
  • 2021-07-30
  • 2022-12-23
  • 2022-01-22
  • 2022-12-23
  • 2021-10-16
  • 2022-02-02
  • 2022-01-01
猜你喜欢
  • 2022-01-25
  • 2022-02-22
  • 2022-03-02
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案