170823、SQL Update多表联合更新的方法
SQL Update多表联合更新的方法
(1) sqlite 多表更新方法
update t1 set col1=t2.col1
from table1 t1
inner join table2 t2 on t1.col2=t2.col2
这是一个非常简单的批量更新语句 在SqlServer中支持此语法 sqlite中却不支持 sqlite中可转换为 如下语法
update table1 set col1=(select col1 from table2 where col2=table1.col2) update ta_jbnt_tzhd_pht_Area_xiang set t1=(select sys_xzqhdm.name from sys_xzqhdm
where t2=sys_xzqhdm.code) (2) SQL Server 多表更新方法
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 a set a.gqdltks=b.gqdltks,a.bztks=b.bztks from landleveldata a,gdqlpj b where a.GEO_Code=b.lxqdm 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); (3) Oracle 多表更新方法
Oracle语法: UPDATE updatedtable SET (col_name1[,col_name2...])= (SELECT
col_name1,[,col_name2...] FROM srctable [WHERE where_definition]) Oracel 示例: update landleveldata a set (a.gqdltks, a.bztks)= (select b.gqdltks,
b.bztks from gdqlpj b where a.GEO_Code=b.lxqdm) (4) MySQL 多表更新方法
MySQL语法: UPDATE table_references SET col_name1=expr1 [, col_name2=expr2 ...]
[WHERE where_definition] MySQL 示例: update landleveldata a, gdqlpj b set a.gqdltks= b.gqdltks, a.bztks=
b.bztks where a.GEO_Code=b.lxqdm
170823、SQL Update多表联合更新的方法的更多相关文章
- 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.col1fr ...
- sql update多表联合更新
update tabA set PrintTag=c.dp_state from tabA a inner join tabB b on a.Code=b.design inner join tabC ...
- Mysql update多表联合更新
下面我建两个表,并执行一系列sql语句,仔细观察sql执行后表中数据的变化,很容易就能理解多表联合更新的用法 student表 ...
- 【SQL】sql update 多表关联更新方法总结
#表结构: 1.表一:Test1 Id name age 1 2 2.表二:Test2 Id name age 1 小明 10 2 小红 8 #实现将表Test2的name和age字段 ...
- sql两个表联合更新
update TableA set id=TableB.id from TableA,TableB where TableA.name=TableB.name
- 数据库:sql 多表联合更新【转】
SQL Update多表联合更新的方法 (1) sqlite 多表更新方法 update t1 set col1=t2.col1 from table1 t1 inner join table2 t2 ...
- SQL update 多表连接方法
SQL Update多表联合更新的方法 () sqlite 多表更新方法 //---------------------------------- update t1 set col1=t2.col1 ...
- Oracle\MS SQL Server Update多表关联更新
原文:Oracle\MS SQL Server Update多表关联更新 一条Update更新语句是不能更新多张表的,除非使用触发器隐含更新.而表的更新操作中,在很多情况下需要在表达式中引用要更新的表 ...
随机推荐
- C#代码安装Windows服务
using System;using System.Collections.Generic;using System.ServiceProcess;using System.Configuration ...
- C# System.Threading.ReaderWriterLockSlim
using System; using System.Threading; using System.Threading.Tasks; using System.Collections.Generic ...
- FTP上传、下载(简单小例子)
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.I ...
- Arrays.asList中所遇到的坑
前言 最近在项目上线的时候发现一个问题,从后台报错日志看:java.lang.UnsupportedOperationException异常 从代码定位来看,原来是使用了Arrays.asList() ...
- Atitit 常用sdk 模块 组织架构切分 规范与范例attilax总结
Atitit 常用sdk 模块 组织架构切分 规范与范例attilax总结 常用200个模块 2017/04/12 22:01 <DIR> acc 2017/04 ...
- PNG、 JPG图片压缩方法
参考链接 https://tinypng.com/developers/reference/python 1.安装 pip install --upgrade tinify 2.使用python脚本压 ...
- GSSAPIAuthentication=no
GSSAPI ( Generic Security Services Application Programming Interface) 是一套类似Kerberos 5的通用网络安全系统接口.该接口 ...
- epoll的由来
reference https://www.zhihu.com/question/20122137 感谢 @静海听风 @蓝形参 数据流有两个重要的参与者: 1.往流中写入数据者 2.从流中读取数据者 ...
- Json字符串转DataTable
/// <summary> /// 将json转换为DataTable /// </summary> /// <param name="strJson" ...
- (转) mysql中left join,right join,inner join的区别
转自:https://blog.csdn.net/qq_35975416/article/details/78842958 sql查询中有一个非常重要的环节就是表的关联查询,一般使用left join ...