You can‘t specify target table ‘Person‘ for update in FROM clause
背景:
原因:简言之,就是mysql不支持在一个表同时实现查找和删除。
解决方案:中间表,查到之后 再select一次。
//错误代码delete from Person
where id not in
(select MIN(Id) as idfrom Person group by Email
)//正确代码delete from Person
where id not in
(select t.id from (select MIN(Id) as idfrom Person group by Email) t
)
You can‘t specify target table ‘Person‘ for update in FROM clause相关推荐
- 错误: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 tempA ...
- MySQL 语法问题:You can‘t specify target table ‘xxx‘ for update in FROM clause. 原因及解决方法
报错信息如下: [Code: 1093, SQL State: HY000] You can't specify target table 'bd_bankaccbas' for update in ...
- You can't specify target table 'TS_AUTH_ADMIN' for update in FROM clause记录
1. 报错:You can't specify target table 'TS_AUTH_ADMIN' for update in FROM clause, 百度查到说是,不能在同一语句中先sele ...
- [Err] 1093 - You can't specify target table 'xxx' for update in FROM clause解决方法
执行开发同学提供的删除数据的sql时报错[Err] 1093 - You can't specify target table 'run_result' for update in FROM clau ...
- [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 ...
- 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 ...
- MySQL||SQL_ERROR_INFO: “You can‘t specify target table ‘titles_test‘ for update in FROM clause“
一.问题描述 假定test数据库存在表titles_test,表内数据如下: 先要求删除emp_no重复的记录,只保留最小的id对应的记录.编写代码如下: delete from titles_tes ...
- mysql-1093 - You can‘t specify target table ‘titles_test‘ for update in FROM clause
错误 DELETE FROM titles_test WHERE id NOT IN(SELECT MIN(id)FROM titles_testGROUP BY emp_no); 入上述操作会报错: ...
- mysql实战(五)—— You can‘t specify target table ‘org_department‘ for update in FROM clause
系列文章目录 You can't specify target table 'org_department' for update in FROM clause 系列文章目录 背景 具体实现过程 1. ...
- MySQL [1093] You can‘t specify target table ‘titles_test‘ for update in FROM clause
执行以下语句: delete from titles_test where id not in(select min(id)from titles_testgroup by emp_no); 会报出错 ...
最新文章
- 7.11.4 第一个程序 设置环境变量
- 怎么删除Elasticsearch里的index内容
- 普通程序员,几个月如何成功转型AI?
- ITK:高斯的一阶导数进行卷积来计算图像的梯度
- OpenCV实战【2】HOG+SVM实现行人检测
- 什么是嵌入式视觉、行业应用、目前挑战
- 字体感觉小了 引入的vant_动态字体海报如何设计与制作?
- 商品搜索——输入联想|智能提示探索
- 中国首个 SaaS 模式的云告警平台 iOS 版 APP 上线
- KK集团完成门店系统一期上云
- CentOS7搭建本地yum源之http服务
- 怎样用计算机绘制幂函数图像,几何画板如何画幂函数的图像
- android ui组件 推荐,GitHub - zzti/XUI: 一个简洁而优雅的Android原生UI框架,解放你的双手!...
- 查找算法:二分法,插值法的公式详解——菜鸟进阶的必经之路!!!
- 关于聪明与努力的文章.
- 《nodejs+gulp+webpack基础实战篇》课程笔记(六)--附加课
- Android开发实用小工具三——面积转换工具
- 菜鸟炒美股(一) (转)
- 游戏地图背景移动C++
- 德邦快递接口开发-java(【新】下单服务接口)
热门文章
- Android进阶知识树——Android消息队列
- TCP与UDP的区别:
- webstorm 2017.2 汉化包 中文激活破解版(附汉化教程)
- DC/DC直流隔离升压电源模块5V12V24V转60V/100V/110V/150V/200V/250VDC
- mysql如何插入图片和视频_mysql中怎样插入图片
- linux xz命令
- Android学习---zygote(上)
- linux mysql编译参数,Mysql 编译参数详解
- centos-基本命令
- 指针的形式与动态存储分配