赞
踩
1) Oracle 多表更新方法:
Oracle语法: UPDATE updatedtable SET (col_name1[,col_name2...])= (SELECT col_name1,[,col_name2...] FROM srctable [WHERE where_definition])
例子:UPDATE A a SET (a.a1,a.a2)=(SELECT b.b1,b,b2 FROM B b WHERE b.b3=a.a3)
2) MySql多表更新方法:
MySql语法:UPDATE table_references SET col_name1=expr1 [, col_name2=expr2 ...] [WHERE where_definition]
例子:UPDATE A a , B b SET a.a1 = b.b1 , a.a2 = b.b2 WHERE a.a3 = b.b3
3) SQLServer多表更新方法:
SQLServer语法:UPDATE { table_name WITH ( < table_hint_limited > [ ...n ] ) | view_name | rowset_function_limited } SET { column_name = { expression | DEFAULT | NULL } | @variable = expression | @variable = column = expression } [ ,...n ] { { [ FROM { < table_source > } [ ,...n ] ] [ WHERE < search_condition > ] } | [ WHERE CURRENT OF { { [ GLOBAL ] cursor_name } | cursor_variable_name } ] } [ OPTION ( < query_hint > [ ,...n ] ) ]
例子:UPDATE a SET a.a1 = b.b1 , a.a2 = b.b2 FROM A a , B b WHERE a.a3 = b.b3
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。