Can't specify target table for update in FROM clause
UPDATE tbl SET col = (
SELECT ... FROM (SELECT.... FROM) AS x);
额外嵌套了一个 SELECT 语句
例如LeetCode 中的 Delete Duplicate Emails
正解:
DELETE
FROM
Person
WHERE
id NOT IN ( SELECT id FROM ( SELECT min( id ) AS id FROM Person GROUP BY email ) AS m );
错解:
DELETE
FROM
Person
WHERE
id NOT IN ( SELECT min( id ) AS id FROM Person GROUP BY email );
Can't specify target table for update in FROM clause的更多相关文章
- mysql-You can’t specify target table for update in FROM clause错误
mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表( ...
- mysql中You can’t specify target table for update in FROM clause错误解决方法
mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表( ...
- mysql 一个较特殊的问题:You can't specify target table for update in FROM clause
mysql 一个较特殊的问题:You can't specify target table for update in FROM clause 即:不能先select出同一表中的某些值,再update ...
- mysql中You can't specify target table for update in FROM clause
使用mysql在删除表中重复记录 delete from user where username in (select user name form(select username from user ...
- MySQL之You can't specify target table for update in FROM clause解决办法
这篇文章主要介绍了mysql中You can't specify target table for update in FROM clause错误解决方法,需要的朋友可以参考下 MySQL中You c ...
- MySQL 出现You can't specify target table for update in FROM clause错误解决方法
MySQL出现You can’t specify target table for update in FROM clause 这个错误的意思是不能在同一个sql语句中,先select同一个表的某些值 ...
- MYSQL 1093 之You can't specify target table for update in FROM clause解决办法
You can't specify target table for update in FROM clause含义:不能在同一表中查询的数据作为同一表的更新数据. 出现以上错误,是因为想将表自身的字 ...
- MYSQL之You can't specify target table for update in FROM clause解决办法
mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表( ...
- mysql error:You can't specify target table for update in FROM clause
mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表( ...
- Mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表(在同一语句中)。
将select出的结果再通过中间表select一遍,这样就规避了错误.注意,这个问题只出现于mysql,mssql和oracle不会出现此问题. mysql中You can't specify tar ...
随机推荐
- java知识随笔整理-Oracle存储过程优缺点
优点: 1.存储过程可以使得程序执行效率更高.安全性更好. 2.建立过程不会很耗系统资源,因为过程只是在调用才执行. 3.存储过程可以用于降低网络流量,存储过程代码直接存储于数据库中,所以不会产生大量 ...
- 【LOJ】#3121. 「CTS2019 | CTSC2019」无处安放
第一次有耐心去研究一道题答-- 以前看到题答要么扔要么就水能简单手玩出来的 1 2可以手玩出来,快乐! 4呢发现3 3比较格路,就把3 3都配了,一边带个4的除了4 4都塞满这么放进去,然后把一边带2 ...
- Photon Server初识(二) ---通过NHibernate 映射数据库
一.下载 NHibernate.dill 官网:https://nhibernate.info 或者通过NuGet下载(详情看上一节) 二.新建一个项目,并引入包 引入包 三.配置(重点) 1.配置x ...
- tp5 post接到的json被转义 问题解决
今天做项目的时候前端需要可以保存可变数据, 然后原样返回给前端 接口 $data =input('post.');//用户唯一标识$goods = $data['goods']; $shopcuxia ...
- Stardew Valley(星露谷物语)Mod开发之路 1环境配置
首先来说明一下,我写这个章节本身也是对学习过程的记录,主要参考了http://canimod.com/guides/creating-a-smapi-mod中的内容.也推荐大家看看. *这些是我的开发 ...
- IntelliJ IDEA Spring boot devtools 实现热部署
一.spring-boot-devtools是一个为开发者服务的一个模块,其中最重要的功能就是自动部署新代码. 二.原理 使用了两个ClassLoader,一个ClassLoader用来加载那些不会变 ...
- 作业6:Java虚拟机类加载机制
一.概述 1.定义 虚拟机类加载机制:把类的数据从Class文件加载进内存,并对数据作校验.转换解析和初始化,最终形成可被JVM直接使用的Java类型. 2.与C/C++的不同 Java不在编译时进行 ...
- url协议+域名+端口号
string url = System.Web.HttpContext.Current.Request.Url.Scheme + "://" + ...
- BZOJ2456-mode题解--一道有趣题
题目链接: https://www.lydsy.com/JudgeOnline/problem.php?id=2456 瞎扯 这是今天考的模拟赛T2交互题的一个30分部分分,老师在讲题时提到了这题.考 ...
- 4.ID主键生成策略
保证唯一性(auto_increment) 一.xml方式 <?xml version="1.0"?> <!DOCTYPE hibernate-mapping P ...