赞
踩
1、SQLServer多表更新方法:
update A
set A.name=B.name,A.age=B.age
from A
inner join B
on A.id=B.id and 条件…
2、Oracle 多表更新方法:
语法:
UPDATE updatedtable
SET (col_name1[,col_name2…])= (SELECT col_name1,[,col_name2…]
FROM srctable [WHERE where_definition])
例子:
update A
set (A.name,A.age)=
(select B.name,B.age from B where B.id=A.id)
3、MySql多表更新方法:
语法:
UPDATE table_references
SET col_name1=expr1 [, col_name2=expr2 …] [WHERE where_definition]
例子:
update A,B
set A.name=B.name,A.age=B.age
where A.id=B.id
4、一般通用方法:
update A
set name=(select name from B where B.id=A.id),
age=(select age from B where B.id=A.id)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。