mysql You can't specify target table 'xxx' for update in FROM clause
含义:您不能在子句中为更新指定目标表'xxx'。
错误描述:删除语句中直接含select,如下:
DELETE FROM meriadianannotation WHERE
SeriesID IN (
SELECT
SeriesID as tid
FROM
meriadianannotation
GROUP BY
SeriesID
HAVING
count(SeriesID) > 1
)
AND data NOT IN (
SELECT
min(data) as bid
FROM
meriadianannotation
GROUP BY
SeriesID
HAVING
count(SeriesID) > 1
)
解决方法:加临时表,如下,
DELETE FROM meriadianannotation WHERE
SeriesID IN (
select t.tid from(
SELECT
SeriesID as tid
FROM
meriadianannotation
GROUP BY
SeriesID
HAVING
count(SeriesID) > 1
) t
)
AND data NOT IN (
select b.bid from(
SELECT
min(data) as bid
FROM
meriadianannotation
GROUP BY
SeriesID
HAVING
count(SeriesID) > 1
) b
)
mysql You can't specify target table 'xxx' for update in FROM clause的更多相关文章
- mysql You can't specify target table 'xxx' for update in FROM clause的解决
DELETE from sp_goodscontent where goodsId in (SELECT t.goodsId from ( SELECT goodsId FROM sp_goodsco ...
- You can't specify target table 'xxx' for update in FROM clause
1.执行sql语句报上面的错误: DELETE FROM db_student WHERE RowGuid IN ( SELECT RowGuid FROM db_student WHERE age ...
- 关于mysql 5.7版本“报[Err] 1093 - You can't specify target table 'XXX' for update in FROM clause”错误的bug
不同于oracle和sqlserver,mysql并不支持在更新某个表的数据时又查询了它,而查询的数据又做了更新的条件,因此我们需要使用如下的语句绕过: , notice_code ) a) ; 本地 ...
- 错误: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 t ...
- Mysql -- You can't specify target table 'address' for update in FROM clause
做地址管理时,需要先根据要设为默认的地址的用户将用户的其他地址都设置为非默认 需要select出用户id然后update 原语句 update address set isdeafult = 0 wh ...
- mysql You can't specify target table 'sys_org_relation' for update in FROM clause 删除表条件不能直接包含该表
mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表( ...
- django.db.utils.OperationalError: (1093, "You can't specify target table 'xxx' for update in FROM clause")
这个错误的意思是,不能在update某张表的where条件中,再次select这张表的某些值作为筛选条件,比如: update message set content = "hello&qu ...
- mysql You can't specify target table 'sys_right_menu' for update in FROM clause (不能从Objor子句中指定目标表“SysRyType菜单)
错误语句: DELETE from sys_right_menu where right_id in (SELECT m.right_id from sys_right_menu mLEFT JO ...
- Mysql You can't specify target table 'newsalrecord' for update in FROM clause
这个问题是不能先select出同一表中的某些值,再update这个表(在同一语句中),即不能依据某字段值做判断再来更新某字段的值.解决办法就是建立个临时的表.
随机推荐
- Ubuntu修改桌面为Desktop
想用中文系统,却不想用中文文件夹,可以用以下方法: 先把home路径下的桌面文件夹修改为Desktop 然后在命令行输入 nano ~/.config/user-dirs.dirs 修改后ctrl - ...
- PL/SQL报错:ORA-28000:the account is locked
第一种方法(图形操作):第一步:使用PL/SQL,登录名为system,选择类型的时候把Normal修改为SYSDBA:第二步:选择users下的system,右击点击“编辑”: 第三步:修改密码,把 ...
- Kb Article Helper
using System; using Microsoft.Xrm.Sdk; using Microsoft.Crm.Sdk.Messages; using Microsoft.Xrm.Sdk.Que ...
- Security 安全框架1
security 过滤器链 检查请求是否有请求信息-主要校验规则 UsernamePasswordAuthenticationFilter: 处理表单登录, 请求是否带用户名密码 BasicAuthe ...
- Python彩蛋--zen of python
今天早上在公交上浏览博客的时候,发现了python里面的一个小彩蛋--zen of python 一首python之歌 我们来看一看... 是不是很简单,在python shell 里 输入 im ...
- SQL学习笔记:函数
SQL函数 AVG select AVG(col) AS avgvalue from tablename select col2 from tablename where col1>(selec ...
- FPGA静态时序分析基础
FPGA静态时序分析基础 基本概念 Skew: 时钟偏移 Skew表示时钟到达不同触发器的延时差别,Tskew = 时钟到达2号触发器的时刻 - 时钟到达1号触发器的时刻. Jitter: 时钟抖动 ...
- PL/SQL轻量版(二)——基本语法
一.流程控制 1.条件判断 语法: IF <布尔表达式> THEN PL/SQL 和 SQL语句 END IF; IF <布尔表达式> THEN PL/SQL 和 SQL语句 ...
- 20155207第二周myod以及课堂测试
第二周myod以及课堂测试 第二周测试5 题目 1.除了main.c外,其他4个模块(add.c sub.c mul.c div.c)的源代码不想给别人,如何制作一个mymath.so共享库?main ...
- 20155223 2016-2017-2 《Java程序设计》第10周学习总结
20155223 2016-2017-2 <Java程序设计>第10周学习总结 教材学习内容总结 Java Socket编程 网络上的两个程序通过一个双向的通讯连接实现数据的交换,这个双向 ...