update set join和 update set from
mysql 不支持 update set … from … where 类似语句。
UPDATE `wise_region_alarm_detail` xzc SET xzc.calculation_type=qwe.tar
FROM
(SELECT wrp.device_id,wrp.point_name,wrp.calculation_type AS tar,wrad.id AS iidd
FROM `wise_region_alarm_detail` wrad
LEFT JOIN `wise_region_alarm` wra ON wrad.alarm_id=wra.id
LEFT JOIN `wise_region_rule` wrr ON wra.rule_id=wrr.id
LEFT JOIN `wise_region_point` wrp ON wrr.id=wrp.rule_id ) qwe
WHERE xzc.calculation_type IS NULL AND
xzc.device_id=qwe.device_id AND xzc.point_name=qwe.point_name AND xzc.id=qwe.iidd
上句报格式错误。
正确写法
update 表1 join 表2 on 条件
set
where 条件
UPDATE `wise_region_alarm_detail` wradLEFT JOIN `wise_region_alarm` wra ON wrad.alarm_id=wra.id
LEFT JOIN `wise_region_rule` wrr ON wra.rule_id=wrr.id
LEFT JOIN `wise_region_point` wrp ON wrr.id=wrp.rule_idSET wrad.calculation_type=wrp.calculation_type
WHERE wrad.calculation_type IS NULL
或者
update 表a,表b(可以用子查询) set 表a的某字段= 表b的某字段
where 表a的某字段= 表b的某字段
或者,省略表直接=子查询
update xcs_user_credit_score a1,xcs_user_credit_score a2
set a1.user_currday_score=(case when a1.user_currday_score+10<0 then a1.user_currday_score+10 else 0 end)
where a1.pt_day='2017-09-20' and a2.pt_day='2017-09-19'
and a1.uid=a2.uid
and (a1.seqing_score=0 and a1.user_silent_score=0 and a1.jubao_score=0 and a1.chengpaopao_score=0 and a1.weifan_score=0)
and a1.user_currday_score<0
update set join和 update set from相关推荐
- update inner join mysql_Mysql update inner join
一:需求 A表和B表的表结构相同,A表是历史表,B表是增量数据表:想要根据关联条件更新A表中的数据. 二:表结构 CREATE TABLE `A` ( `id` bigint(20) NOT NULL ...
- Update与JOIN使用
Update与JOIN使用 update a表名 set a字段 from a表名 join b表名 on a字段=b字段 where a字段>常量 and b字段=常量 posted on 2 ...
- 【转载】SQL中使用update inner join和delete inner join
原文地址:SQL中使用update inner join和delete inner join Update XXX set XXX where 这种写法大家肯定都知道,才发现update和delete ...
- SQLServer UPDATE INNER JOIN、DELETE INNER JOIN
UPDATE INNER JOIN UPDATE A SET Name='whq'FROM TableA AS AINNER JOIN TableB AS B ON A.ID=B.IDWHERE A. ...
- mysql update join 更新_mysql多表join时候update更新数据的方法 | 很文博客
如果item表的name字段为''就用resource_library 表的resource_name字段前面加上字符串Review更新它,他们的关联关系在表resource_review_link中 ...
- update inner join on 使用(批量更新)
update inner join on 使用(批量更新) 文章目录 update xxx inner join xxx on 使用方法 注意: update xxx inner join xxx o ...
- mysql update inner join 多表_UPDATE INNER JOIN 两表联合更新
1 UPDATEB_READMETER_HANDWORK2 INNER JOIN B_READMETER_ORDER_SP ON B_READMETER_HANDWORK.ID =B_READMETE ...
- SAP CRM IBASE在ABAP update task中实现update和delete操作
本文介绍SAP CRM IBASE在ABAP update task中实现update和delete操作的原理. 要获取更多Jerry的原创文章,请关注公众号"汪子熙":
- MySQL update For_mysql SELECT FOR UPDATE语句使用示例
以MySQL 的InnoDB 为例,预设的Tansaction isolation level 为REPEATABLE READ,在SELECT 的读取锁定主要分为两种方式: SELECT ... L ...
最新文章
- 苹果为了不让AirTag被用来跟踪,将推出一个安卓应用
- # 华硕笔记本电脑如何配置win10系统U盘 # 以及安装或重装win10系统#
- PHP 规范之编程规范
- 杭电1421java实现
- 模板参数仅作为函数的返回值
- 《C++ Primer 第五版》(第4.1-4.11节) ——运算符的执行顺序问题,负值坐商取余问题,数值的移位操作
- Linux 原生异步 IO 原理与使用
- 将有格式的int解析成float
- linux 邮件服务器pop3,linux下用pop3收web电子邮箱_邮件服务器
- AngularJS 模板
- FIND_IN_SET使用场景
- centos下安装php-fpm,centos下怎么安装php-fpm
- 硬件基础之TTL、CMOS区分比较
- 数学建模论文写作要求
- 自己开发的一套实用故障报修管理系统【分享推荐大家】
- 不规则四面体知道六边的体积公式
- GITHUB代码永久保存计划
- 深入理解示波器探头各种作用及工作原理
- 楚留香冰最新服务器,一梦江湖:各门派冰雪外观极寒之刃上线,冰晶透亮玩家直呼绝了!...
- java panel 左对齐,JPanel左对齐
热门文章
- Python读取音文件
- WIN10修改时间到2050年以后,出现屏幕闪烁资料搜索
- Basketball English
- 颜色模型转换(matlab)
- python练习10:打印楼梯,同时在楼梯上方打印两个笑脸。
- Sapphire 手机连接打印机控件Sapphire IrDA Utility龙博方案网详细介绍
- Python3 list 排序函数详解
- linux移动新建文件夹,Linux(centos)新建,删除,移动文件夹和文件的命令
- 宏基因组数据处理 - Nanopore下机数据fast5格式
- [Python] 中文编码问题:raw_input输入、文件读取、变量比较等str、unicode、utf-8转换问题...