Mysql update in报错 [Err] 1093 - You can't specify target table 'company_info' for update in FROM clause
Mysql update in报错 解决方案:
[Err] 1093 - You can't specify target table 'company_info' for update in FROM clause
意思是不能在同一语句中更新select出的同一张表元组的属性值
解决方法:将select出的结果通过中间表再select一遍即可。
错误sql:
update company_info set email = 'ttt@163.com'
where id in (select t.id from company_info t where t.id<3)
修改后可执行的sql:
update company_info set email = 'ttt@163.com'
where id in (select a.id from (select t.id from company_info t where t.id<3)a )
Mysql update in报错 [Err] 1093 - You can't specify target table 'company_info' for update in FROM clause的更多相关文章
- 关于mysql 5.7版本“报[Err] 1093 - You can't specify target table 'XXX' for update in FROM clause”错误的bug
不同于oracle和sqlserver,mysql并不支持在更新某个表的数据时又查询了它,而查询的数据又做了更新的条件,因此我们需要使用如下的语句绕过: , notice_code ) a) ; 本地 ...
- [Err] 1093 - You can't specify target table 's' for update in FROM clause
[Err] 1093 - You can't specify target table 's' for update in FROM clause 执行SQL DELETE from book WHE ...
- MySQL: [Err] 1093 - You can't specify target table 'bk' for update in FROM clause
错误的意思说,不能先select出同一表中的某些值,再update这个表(在同一语句中). 例如下面这个sql: delete from tbl where id in ( select ...
- [Err] 1093 - You can't specify target table 'master_data' for update in FROM clause
delete from master_data where category_id not in (select category_id from master_data a, bc_category ...
- MySQL 1093 - You can't specify target table 'sc' for update in FROM clause
错误代码如下: #(8) 把"邓维杰"同学的成绩全部删除. SELECT * FROM sc WHERE EXISTS(SELECT * FROM student WHERE st ...
- MySQL中执行sql语句错误 Error Code: 1093. You can't specify target table 'car' for update in FROM clause
MySQL中执行sql语句错误 Error Code: 1093. You can't specify target table 'car' for update in FROM clause 201 ...
- 1093 - You can't specify target table 'account' for update in FROM clause
目的:查询一张表的相同的两条数据,并删除一条数据. 分析 先查询出相同的数据,然后删除 查询相同的数据 SELECT a.id FROM account a GROUP BY a.username H ...
- django.db.utils.OperationalError: (1093, "You can't specify target table 'xxx' for update in FROM clause")
这个错误的意思是,不能在update某张表的where条件中,再次select这张表的某些值作为筛选条件,比如: update message set content = "hello&qu ...
- mysql 1093 - You can't specify target table 'xx表' for update in FROM clause
为了修复节点表某批次数据的用户数据,做出了以下尝试: , name , , )); 执行:[Err] 1093 - You can't specify target table 'zs_work_ap ...
随机推荐
- shell编程/字库裁剪(3)——验证
版权申明:本文为博主窗户(Colin Cai)原创,欢迎转帖.如要转贴,必须注明原文网址 http://www.cnblogs.com/Colin-Cai/p/7712496.html 作者:窗户 Q ...
- angular1与swiper
angular1路由切换过程中swiper不能使用. 问题1:在刚开始使用angular1的路由时,好多人会将swiper的初始化写在模板的父控制器上,这样会造成一个问题,swiper的初始化只在页面 ...
- asp中日志方法
代码文件log.asp中内容如下: <% Function getPath() getPath = request.servervariables("APPL_PHYSICAL_PAT ...
- yii2之数据验证
一.场景 什么情况下需要使用场景呢?当一个模型需要在不同情境中使用时,若不同情境下需要的数据表字段和数据验证规则有所 不同,则需要定义多个场景来区分不同使用情境.例如,用户注册的时候需要填写email ...
- centos7 最小安装无ifconfig
可能不会有人看到这篇文章,加入有幸被看到,建议读者从后往前看!最小化安装问题:1 没有ifconfig 命令,解决:yum install net-tools2 使用yum install n ...
- 使用sklearn进行数据挖掘-房价预测(4)—数据预处理
在使用机器算法之前,我们先把数据做下预处理,先把特征和标签拆分出来 housing = strat_train_set.drop("median_house_value",axis ...
- virualbox 搭建 otter
前言 为了学习otter,上一篇我们讲到了 otter 必要软件的安装,参考:virualbox 安装 otter 必备软件,现在安装otter,相比官方文档,我们尽量简化安装步骤. virualbo ...
- Being a Good Boy in Spring Festival(尼姆博弈)
Being a Good Boy in Spring Festival Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 ...
- Python-week1,第一周(基于Python3.0以上)
1,变量 准确来说不是第一周学习了吧,应该是采用博客记录学习的第一周,记录并做个笔记吧,可能做的不好,但我高兴啊,废话不说了,上图. 学习过程中做的一些笔记,当然能面面俱到,只能在写博客的时候又能复习 ...
- YARN作业运行机制
在传统的MapReduce中, Jobtracker同时负责作业调度(将任务调度给对应的tasktracker)和任务进度管理(监控任务, 重启失败的或者速度比较慢的任务等). YARN中将Jobtr ...