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 ...
随机推荐
- 怎么样防止Sql注入
(1)对于动态构造SQL查询的场合,可以使用下面的技术: 第一:替换单引号,即把所有单独出现的单引号改成两个单引号,防止攻击者修改SQL命令的含义.再来看前面的例子,“SELECT * from Us ...
- JS的基本类型(小知识)
一:js中的基本类型: 基本类型:boolen, string ,number,null,undefined 引用类型:object,和函数 二.undedifned和null的区别: 1 undef ...
- Yii2之事件
众所周知,yii的三大特性是:属性.事件.行为,上一篇博文简单讲解了yii中的属性,本文接着讲讲yii的事件. 事件是代码解耦的一种方式,设计业务流程的一种模式.在yii2.0中,通过Yii\base ...
- C11 constant expressions 常量表达式
一图流总结hhh
- 爱上朴实的CSS细节
英文原文:Learning to Love the Boring Bits of CSS 未来的CSS太让人兴奋了:一方面,是全新的页面布局方式:另一方面,是酷炫的滤镜.颜色等视觉效果.这些CSS, ...
- 使用css3实现瀑布流布局效果
使用CSS3可以轻松实现瀑布流布局,但这种方法有个缺点,就是对于商城类型的网站,价格筛选时,并不能达到理想效果. 1.column-count 把div中的文本分为多少列 2.column-width ...
- Numpy数组索引为-1和None
numpy的数组操作方便,可以用:来切片,用布尔数组或者布尔表达式来查找符合条件的数据,也可以用数组作为另一个数组的索引来查找指定的数据.但有时也会见到数组索引为-1和None.两者的用法如下: 1. ...
- thinkphp项目在apache服务器中“去掉”index.php后出现找不到url的问题
今天将MAC中apache环境下的thinkphp项目移植到windows中得apache环境下.原本都是apache环境,而且配置都一样,死活给我这样的提示: Not Found The reque ...
- Sequence one
Problem Description Search is important in the acm algorithm. When you want to solve a problem by us ...
- Clipboard 剪辑板
ie是最早支持剪辑板相关事件(并且允许javascript接入)的浏览器(鼠标右键复制) 相关事件: beforecopy— Fires just before the copy operatio ...