T-SQL 之 多表联合更新
1、 sqlite 多表更新方法
UPDATE tA SET col1=tB.col1
FROM tableA tA INNER JOIN tableB tB ON tA.col2=tB.col2
这是一个非常简单的批量更新语句 在SqlServer中支持此语法 sqlite中却不支持,sqlite中可转换为如下语法:
UPDATE tableA SET col1=(SELECT col1 FROM tableB WHERE col2=tableA.col2)
2、SQL Server 多表更新方法
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 ] ) ]
SQL Server示例:
UPDATE tA SET tA.col1=tB.col1,tA.col2=tB.col2
FROM tableA tA,tableB tB
WHERE tA.col3=tB.col3
3、access数据库多表更新方法
x = "update " + DLTB + " a inner join tbarea2 b on a.objectid=b.FID set a." + fd_dltb_xzdwmj + "=b.area_xzdw, a." + fd_dltb_lxdwmj + "=b.area_lxdw";
SQLList.Add(x);
4、Oracle 多表更新方法
UPDATE updatedtable
SET (col_name1[,col_name2...])=(SELECT col_name1,[,col_name2...] FROM srctable
[WHERE where_definition])
Oracel 示例:
UPDATE tableA tA SET (tA.col1, tA.col2)=(SELECT tB.col1,tB.col2 FROM tableB tB
WHERE tA.col3=tB.col4)
5、MySQL 多表更新方法
UPDATE table_references SET col_name1=expr1 [, col_name2=expr2 ...]
[WHERE where_definition]
MySQL 示例:
UPDATE tableA tA, tableB tB
SET tA.col1=tB.col1, tA.col2=tB.col2
WHERE tA.col3=tB.col4
T-SQL 之 多表联合更新的更多相关文章
- 170823、SQL Update多表联合更新的方法
SQL Update多表联合更新的方法 (1) sqlite 多表更新方法 update t1 set col1=t2.col1 from table1 t1 inner join table2 t2 ...
- SQL Update多表联合更新的方法
SQL Update多表联合更新的方法 (1) sqlite 多表更新方法 update t1 set col1=t2.col1 from table1 t1 inner join table2 t2 ...
- sql update多表联合更新
update tabA set PrintTag=c.dp_state from tabA a inner join tabB b on a.Code=b.design inner join tabC ...
- sql两个表联合更新
update TableA set id=TableB.id from TableA,TableB where TableA.name=TableB.name
- 书写 sql 中关于 update 多表联合更新的方法
SQL Update多表联合更新的方法(1) sqlite 多表更新方法//----------------------------------update t1 set col1=t2.col1fr ...
- 数据库:sql 多表联合更新【转】
SQL Update多表联合更新的方法 (1) sqlite 多表更新方法 update t1 set col1=t2.col1 from table1 t1 inner join table2 t2 ...
- Mysql update多表联合更新
下面我建两个表,并执行一系列sql语句,仔细观察sql执行后表中数据的变化,很容易就能理解多表联合更新的用法 student表 ...
- PostgreSQL update set from 两表联合更新,注意与其它数据库更新语法有差别
最近用PostgreSql数据库进行表关联更新时,发现与之前用的Sql Server 和My Sql语法有很大差别,稍微不注意,很容易出错. PostgreSql表更新时,两个表只允许一个表起别名,一 ...
- mysql 多表联合更新
UPDATE mall_order moLEFT JOIN mall_order_goods mog ON mo.id = mog.order_idSET mo.ratio=0.08WHERE mog ...
随机推荐
- <转载>浅谈C/C++的浮点数在内存中的存储方式
C/C++浮点数在内存中的存储方式 任何数据在内存中都是以二进制的形式存储的,例如一个short型数据1156,其二进制表示形式为00000100 10000100.则在Intel CPU架构的系统中 ...
- Python的高级Git库 Gittle
Gittle是一个高级纯python git 库.构建在dulwich之上,提供了大部分的低层机制 Gittle是一个高级纯python git 库.构建在dulwich之上,提供了大部分的低层机制. ...
- Python基础 数字、字符串、列表、元组、字典
Number(数字)---> int.float.complex(复数) class int 在Python3中,整形(int)就是常见的整数:1,100,500,1000...... 浮点型( ...
- Codeforces 719 E. Sasha and Array (线段树+矩阵运算)
题目链接:http://codeforces.com/contest/719/problem/E 题意:操作1将[l, r] + x; 操作2求f[l] + ... + f[r]; 题解:注意矩阵可以 ...
- LIS LCS n^2和nlogn解法 以及LCIS
首先介绍一下LIS和LCS的DP解法O(N^2) LCS:两个有序序列a和b,求他们公共子序列的最大长度 我们定义一个数组DP[i][j],表示的是a的前i项和b的前j项的最大公共子序列的长度,那么由 ...
- 【CSDN博客之星】2013年CSDN博客之星正在评选,希望大家支持,非常感谢!
首先在此感谢 MoreWindows 秒杀多线程面试题系列让我成长和学习,同时也借鉴了很多优秀观点和示例! 请各位读者可以支持MoreWindows,让更优秀的文章陪伴我们! 各位读者好, 本人博客自 ...
- Ehcache(06)——监听器
http://haohaoxuexi.iteye.com/blog/2119353 监听器 Ehcache中监听器有两种,监听CacheManager的CacheManagerEventListene ...
- Rstudio安装
1.https://www.r-project.org/下载R语言(注意32位还是46位系统). 2.安装R,尽量默认安装路径,安装路径不要有中文. 3.https://www.rstudio.com ...
- CodeForces 164C Machine Programming 费用流
Machine Programming 题目连接: http://codeforces.com/problemset/problem/164/B Descriptionww.co One remark ...
- Codeforces Educational Codeforces Round 3 E. Minimum spanning tree for each edge LCA链上最大值
E. Minimum spanning tree for each edge 题目连接: http://www.codeforces.com/contest/609/problem/E Descrip ...