ERROR 1093 (HY000): You can't specify target table 'test' for update in FROM clause
MySQL执行更新语句报错:
更新语句:UPDATE test SET state=50 WHERE num IN(SELECT num FROM test WHERE state=60);
报错:ERROR 1093 (HY000): You can't specify target table 'test' for update in FROM clause
表数据:
state num
50 101
50 102
50 201
60 202
60 203
解决方式:同表不支持 update子查询结果,将子查询结果,再select一次,就可以了
改成:UPDATE test SET state=50 WHERE num IN(SELECT * FROM (SELECT num FROM test WHERE state=60));
ERROR 1093 (HY000): You can't specify target table 'test' for update in FROM clause的更多相关文章
- MySQL - 1093异常 - You can't specify target table 't' for update in FROM clause
有一个表示地区的表,表结构与数据大概如下表. ID NAME PARENT_ID 1 中国 2 广东省 1 3 广州市 2 4 荔湾区 3 5 越秀区 3 6 番禺区 3 7 小谷围街道 6 现为了查 ...
- 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 ...
- 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 ...
- [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 5.7版本“报[Err] 1093 - You can't specify target table 'XXX' for update in FROM clause”错误的bug
不同于oracle和sqlserver,mysql并不支持在更新某个表的数据时又查询了它,而查询的数据又做了更新的条件,因此我们需要使用如下的语句绕过: , notice_code ) a) ; 本地 ...
- 1093 - You can't specify target table 'account' for update in FROM clause
目的:查询一张表的相同的两条数据,并删除一条数据. 分析 先查询出相同的数据,然后删除 查询相同的数据 SELECT a.id FROM account a GROUP BY a.username H ...
- 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 ...
- You can't specify target table 'ship_product_cat' for update in FROM clause
有时候我们在编辑update时需要select作为条件,在mysql中有时会出现这样的错误:You can't specify target table for update in FROM clau ...
- 【SQL】 java.sql.SQLException: You can't specify target table 'emp' for update in FROM clause
在执行sql: delete from emp where id in (select id from emp where cdate<'2018-02-02') 时报出以下异常: ### Th ...
随机推荐
- Objective-C实用类和协议
Objective-C实用类和协议 目录 概述 NSObject 概述 NSObject 协议<NSObject> 类NSObject 详细方法参考文档 实用操作 是否为某个类或其子类 是 ...
- Jfinal报错sql injection violation, multi-statement not allow
Jfinal报错: com.jfinal.plugin.activerecord.ActiveRecordException: java.sql.SQLException: sql injection ...
- ERROR in [copy-webpack-plugin] unable to locate "D:/xxx/xxx/xxx"
vue打包的时候npm run build报错 ERROR in [copy-webpack-plugin] unable to locate "D:/xxx/xxx/xxx" 这 ...
- 160415、sql语句sort排序,sort为空的在后面
按sort排序,sort为空的在后面 select * from 表名 order by (case when sort is null or sort='' then 1 else 0 end),s ...
- win10系统安装Oracle11报错不满足最低要求
以下问题是,在安装Oracle过程中遇到的问题以及自己的解决方法: 问题一:下载好两个Oracle的安装压缩包文件,同时解压后,启动setup.exe,报错:[INS-13001]环境不满足最低要求. ...
- MySQL 监控指标
为了排查问题,对数据库的监控是必不可少的,在此介绍下 MySQL 中的常用监控指标. 简介 MySQL 有多个分支版本,常见的有 MySQL.Percona.MariaDB,各个版本所对应的监控项也会 ...
- Servlet------>jsp jstl核心标签库
这里不需要刻意记,在jar里,c.tld文件都有,可以自己找源码看
- IBM DEVOPS IN CLOUD--chaos monkey
- 二叉树的先序、中序、后序和中序遍历——Java实现
package treeTraverse; /** * 定义一个树的结点类 */ public class Node { private int data; private Node leftChil ...
- Linux 下的同步机制
2017-03-10 回想下最初的计算机设计,在单个CPU的情况下,同一时刻只能由一个线程(在LInux下为进程)占用CPU,且2.6之前的Linux内核并不支持内核抢占,当进程在系统地址运行时,能打 ...