多表关联更新
来源:互联网 发布:做广告牌用什么软件 编辑:程序博客网 时间:2024/06/05 23:45
有A、B张表,其记录如下:
A表
c1 c2
--------------
1 a1
2 a2
3 a3
8 a8
B表
c1 c3
--------------
1 b1
2 b1
3 b3
10 b10
A.c1与B.c1相等,用一条sql语句,实现A.c2的值更新为B.c3
------------------------
UPDATE A
SET A.c2 =B.c3
from A ,B
where A.c1=B.c1
UPDATE A
SET A.c2 =B.c3
from A inner join B on A.c1=B.c1
注意:update后面是不能跟多表的,但跟在from子句后面
-------------------------------------------
另外,下面是一个mysql语句的多表更新
--------------------------------------------
update sk_general a,
(select a.gid, b.id
from (select gid, eid from sk_general where eid = 140) as a
left join sk_army b on a.gid = b.gid) as c
set a. status = 0
where c.gid = a.gid
and c.id is null;
- 多表关联更新
- 多表关联更新
- 多表关联更新
- 多表更新关联数据
- sqlserver 多表关联 更新
- oracle 多表关联 更新
- Oracle多表关联更新
- oracle多表关联更新
- mysql 多表关联更新
- Oracle多表关联更新
- Sqlserver多表关联更新
- ORACLE多表关联更新
- mysql 多表关联更新
- oracle多表关联更新
- Oracle多表关联更新(update多表关联)
- Oracle多表关联更新(update多表关联)
- ORACLE中的多表关联更新
- oracle UPDATE 多表关联更新
- IT人 不要一辈子靠技术生存
- 年轻人十个不成熟表现
- 使用 U 盘安装 Mac OSX 系统方法
- Android sqlite3查询表中最后一条记录
- 我的Android进阶之旅------>Android Gusture 手势识别小案例
- 多表关联更新
- initialization and destroy methods in bean
- jquery js 获取动态的json键值
- 学习记录:Hadoop之WordCount运行
- const 与指针
- 获取tr下面所有的checkbox的属性为checked的checkbox
- 获取windows系统版本信息
- Entiy Framework研究 - 基础设施层
- [bxd学习java基本点]7.linkedList方法,remove移走的要显示元素