SQL报错:You can’t specify target table ‘person’ for update in FROM clause的解决方法
You can’t specify target table ‘person’ for update in FROM claus
不能在FROM子句中指定要更新的目标表'person'
报错原因:在MySQL中不能在同一条SQL中查询出一张表的某些值,再直接用这些值更新这张表。
解决方案:将查询出的结果用SELECT再查询一次,得到一张额外的临时表,再用临时表的值做更新。
解决前:
delete from person where id in (select b.id as id_id from person as a,person as b where a.email=b.email and a.id<b.id);
解决后:
delete from person where id in (select t.id_id from (select b.id as id_id from person as a,person as b where a.email=b.email and a.id<b.id) as t);
SQL报错:You can’t specify target table ‘person’ for update in FROM clause的解决方法相关推荐
- You can't specify target table 'tablename' for update in FROM clause的解决方法
在执行下面的sql时报错 DELETE FROM temp WHERE id IN (SELECT a.id FROM t_user t JOIN temp a ON t.email = a.emai ...
- MySQL 修改报错 You can't specify target table 'tb_trade' for update in FROM clause
修改前 delete from tb_order where tradeId in ( select o.tradeId from tb_order o INNER JOIN tb_trade t w ...
- 错误: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 'RES_CATALOG_CLASSIFY' for update in FROM clause...
You can't specify target table for update in FROM clause含义:不能在同一表中查询的数据作为同一表的更新数据. 将sql语句 UPDATE RES ...
- 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. ...
- You can't specify target table 'dt_task_apply' for update in FROM clause sql 关联查询 并删除
两个表相互关联,结果 只删除了第一个表 A(task)中数据,导致 B (task_apoly)表数据依旧在, 这个就不好了!由于数据量比较大,还不能直接删除B中所有数据,只能关联查询删除了 dele ...
- 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 ...
- 【mysql 】sql错误代码 1093 You cannot specify target table xxxx for update in FROM clause
在mysql8.X中执行如下语句: DELETE FROM`test`.unsign_wocode WHEREid IN (SELECTa.id FROM`test`.unsign_wocode a, ...
- Vue报错:Uncaught TypeError: Cannot assign to read only property ‘exports‘ of object 的解决方法
Vue报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object 的解决方法 参考文章: (1)Vue ...
最新文章
- [转] DataSet的的几种遍历
- 高通平台android7.1系统显示旋转180度
- Hasor JDBC 的难关,嵌套事务处理思路
- 数据结构--队列(数组)的一种实现
- 强迫症犯了,忍不住赞一下slf4j包Logger.java的优雅代码
- sitecore系列教程之如何以编程方式将访客数据关联到联系人卡片
- Python高级运维开发2016年7月第14期隆重开课
- PAT (Basic Level) 1034 有理数四则运算(模拟)
- macbook系统安装服务器,SVN-Mac安装服务器
- 蓝桥杯 ALGO-68 算法训练 判定数字
- SQL:PostgreSQL设置自增序列
- tomcat官网下载详细步骤
- 利用公网Msf+MS17010跨网段攻击内网
- html中复选框如何添加,Word 怎么添加复选框 怎么在word文档中插入复选框
- 思维导图☆三招十八式
- 助你成为Java大神的十个建议
- 卖计算机英语对话,英语购买电脑情景对话.doc
- 《时代》杂志评出的100部最佳英语小说(含下载)
- 草木有本心,何求美人折
- matlab 图片倒影_计算物理基于matlab方法研究水中倒影问题
热门文章
- Mybatis(一) 入门
- 电脑与电视进行连接的几种方法
- js实现的图片浏览器
- 技术人员的赚钱之道-11:钱是什么?钱能生钱吗?
- [翻译] 第二章 处理借口 (Remote)
- 使用construct2制作射击小游戏
- Cadence原理图绘制不同页面之间的电气连接
- day04【JS高级】BOM对象、Window对象、二种定时器、 Location对象、DOM对象、DOM获取元素、DOM操作内容、DOM操作属性、DOM操作样式、DOM操作元素(标签)、 正则表达式
- origin如何绘制多条折线_使用Origin绘制不相关多组数据折线图的方法
- 笔记本电脑什么牌子好?除了配置还应该关注哪些方面?