【MySQL】解决You can't specify target table 'user_cut_record_0413' for update in FROM clause
问题
You can't specify target table 'user_cut_record_0413' for update in FROM clause
原因
待更新/删除的数据集与查询的数据集撞车了,可以给后面的数据集加个别名,来解决撞车问题
报错语句
delete from user_cut_record_0413 where record_id IN ( select record_id from user_cut_record_0413 GROUP BY record_id HAVING COUNT(record_id) > 1 )
解析语句
delete from user_cut_record_0413 where record_id IN ( select record_id from user_cut_record_0413 GROUP BY record_id HAVING COUNT(record_id) > 1 )
解决方法
delete from user_cut_record_0413
where record_id IN (
select record_id from (select * from user_cut_record_0413) t
GROUP BY record_id
HAVING COUNT(record_id) > 1
)
其实就是把后面的user_cut_record_0413 改成 (select * from user_cut_record_0413) t
【MySQL】解决You can't specify target table 'user_cut_record_0413' for update in FROM clause的更多相关文章
- 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 ...
- update mysql row (You can't specify target table 'x' for update in FROM clause)
sql语句(update/delete都会出现此问题) update x set available_material_id = null where id not in (select id fro ...
- 解决MYSQL的You can't specify target table 'xxxxxxxxxx' for update in FROM clause
出现这个问题的MYSQL的SQL语句形如: DELETE FROM xxxxa WHERE EXISTS (SELECT * FROM xxxx1 WHERE xxxxa.xxid=123) 解决方法 ...
- mysql:You can't specify target table 'bpm_tksign_data' for update in FROM clause
UPDATE bpm_tksign_data WHERE actinstid ' AND nodeid = 'SignTask1' AND batch = ( SELECT max(a.batch) ...
- mysql:You can't specify target table 'sessions' for update in FROM clause
更新数据时,在where条件子句里面如果想使用子查询按条件更新部分数据,需要将查询的结果设为临时表.可以参考: https://blog.csdn.net/poetssociety/article/d ...
- mysql中更新或者删除语句中子语句不能操作同一个表You can't specify target table 'test' for update in FROM clause
问题描述:有个数据表test,有个字段value,如下 mysql> select * from test;+----+------------------------------------+ ...
- 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 FRO ...
- 错误:You can't specify target table 'xxx' for update in FROM clause的解决
问题: 今天在MySQL数据库删除重复数据的时候遇到了一个问题.如下脚本: DELETE FROM tempA WHERE tid IN ( SELECT MAX(tid) AS tid FROM t ...
- 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 ...
随机推荐
- Centos 6.5 本地局域网基于HTTP搭建YUM
服务端配置 init 3 文本 init5 图形 init 0 关机 init 1 重启 ls 查看 mkdir创建文件 关闭防火墙service iptables stop chkconfig ...
- 月薪3万的python程序员都看了这本书
想必大家都看过吧 Python编程从入门到实践 全书共有20章,书中的简介如下: 本书旨在让你尽快学会 Python ,以便能够编写能正确运行的程序 —— 游戏.数据可视化和 Web 应用程序,同时掌 ...
- Spring Security(15)——权限鉴定结构 RoleVoter
http://www.cnblogs.com/fenglan/p/5913432.html
- Python 2 和 3 的区别记录
Python 2 和 3 的区别记录 print 2:关键字,可以 print a,也可以 print(a) 3:内置函数,必须带(),print(a) reload() 2:内置函数,可以直接使用 ...
- vee-validate校验demo
//太长了,把异步校验放到前面吧: VeeValidate.Validator.extend('checkLoginName',{ getMessage:function () { return &q ...
- hdu 3183 A Magic Lamp 【RMQ】
<题目链接> <转载于 >>> > 题目大意: 给出一个长度不超过1000位的数,求删去m位数字以后形成的最小的数字是多少. 解题分析: 分析:我们可以把题 ...
- Codeforces 300C Beautiful Numbers 【组合数】+【逆元】
<题目链接> 题目大意: 给出a和b,如果一个数每一位都是a或b,那么我们称这个数为good,在good的基础上,如果这个数的每一位之和也是good,那么这个数是excellent.求长度 ...
- python 配置导入方式
许多连接,如 from setting import redis_config pool= redis.ConnectionPool(**redis_config) r=redis.Redis(con ...
- Django视图层、虚拟环境
一.虚拟环境安装 目的:为了解决版本共存问题 ''' 1.通过pip3安装虚拟环境: -- pip3 install virtualenv 2.前往目标文件夹: -- cd 目标文件夹 (C:\Vir ...
- javascript中6种基本数据类型详解
javascript中有5中数据类型(也称为基本数据类型):Undefined.Null.Boolean.Number和String,还有一种复杂数据类型——object,object本质是由一组键值 ...