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 ...
随机推荐
- 【BZOJ3238】[Ahoi2013]差异 后缀数组+单调栈
[BZOJ3238][Ahoi2013]差异 Description Input 一行,一个字符串S Output 一行,一个整数,表示所求值 Sample Input cacao Sample Ou ...
- LAMP集群项目二 初始化系统
1.关闭防火墙 /etc/init.d/iptables stop chkconfig iptables off 2.关闭selinux cat /etc/selinux/config #查看状态 s ...
- [ Office 365 开发系列 ] Graph Service
前言 本文完全原创,转载请说明出处,希望对大家有用. 通过[ Office 365 开发系列 ] 开发模式分析和[ Office 365 开发系列 ] 身份认证两篇内容的了解,我们可以开始使用Offi ...
- Python全栈day14(集合)
一,集合 1,集合由不同元素组成 2,无序 3,集合中元素必须是不可变类型 二,定义集合 1,s = {1,2,3,4,5} 2,s = set(hello)以迭代的方式生成集合 s = set(&q ...
- 不想分页怎么办??-->页面数据的滚动加载
在前几天的一次前台数据展示的时候 为了更好的用户的体验 就想着做一个数据的滚动加载功能 于是简单的查询了网上的实现方式 基本都是在页面加载的时候绑定scroll事件 然后判断页面触底的时候 进行aja ...
- 【Python算法】归纳、递归、归简
归简法(reduction) 指的是将某一问题转化成另一个问题,将一个未知问题归简成一个已解决的问题. 归纳法(induction) 首先要证明语句在某一基本情况下是成立的,然后证明他可以由一个对象推 ...
- UIScreen(屏幕)、UIWindow(画框)、UIView(画布)、didFinishLaunchingWithOptions的概念
//didFinishLaunchingWithOptions 方法:顾名思义.在app开始运行时会调用里面的方法.- (BOOL)application:(UIApplication *)appli ...
- spring data jpa 遇到的问题
org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.O ...
- Python3中的urlencode和urldecode
在Python3中,将中文进行urlencode编码使用函数 urllib.parse.quote(string, safe='/', encoding=None, errors=None) 而将编码 ...
- 剑指Offer——字符流中第一个不重复的字符
题目描述: 请实现一个函数用来找出字符流中第一个只出现一次的字符.例如,当从字符流中只读出前两个字符"go"时,第一个只出现一次的字符是"g".当从该字符流中读 ...