含义:您不能在子句中为更新指定目标表'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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 关于mysql 5.7版本“报[Err] 1093 - You can't specify target table 'XXX' for update in FROM clause”错误的bug

    不同于oracle和sqlserver,mysql并不支持在更新某个表的数据时又查询了它,而查询的数据又做了更新的条件,因此我们需要使用如下的语句绕过: , notice_code ) a) ; 本地 ...

  4. 错误: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 ...

  5. Mysql -- You can't specify target table 'address' for update in FROM clause

    做地址管理时,需要先根据要设为默认的地址的用户将用户的其他地址都设置为非默认 需要select出用户id然后update 原语句 update address set isdeafult = 0 wh ...

  6. 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这个表( ...

  7. 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 ...

  8. 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 ...

  9. Mysql You can't specify target table 'newsalrecord' for update in FROM clause

    这个问题是不能先select出同一表中的某些值,再update这个表(在同一语句中),即不能依据某字段值做判断再来更新某字段的值.解决办法就是建立个临时的表.

随机推荐

  1. navicat mysql 存储过程

    存储过程如同一门程序设计语言,同样包含了数据类型.流程控制.输入和输出和它自己的函数库. 一.基本数据类型:略 二.变量: 自定义变量:DECLARE   a INT ; SET a=100; 可用以 ...

  2. activemq的高级特性:通配符式分层订阅

    activemq的高级特性之通配符式分层订阅 队列的名称可以分层:aa.bb.cc.dd 可以匹配:aa.bb.cc.dd,aa.*.cc.dd,aa.> *:匹配当前层的内容 >:任何一 ...

  3. ionic 环境搭建

    1.安装nodejs (8.4.0) 下载地址 https://nodejs.org/zh-cn/ 2.Java jdk  版本号  jdk1.8.0_121 3.安装 cordova npm ins ...

  4. 【Java web 容器resin的安装】

    #resin的安装 #启动resin #访问resin监听的java web容器端口 resin修改端口监听号

  5. SQL逻辑查询处理的步骤序号

    (8)SELECT (9) DISTINCT <select_list> (1)FROM <left_table> (3)<join_type>JOIN<ri ...

  6. [转]windows下多个python版本共存,pip使用

    windows下多个python版本共存,pip使用 2017年09月13日 17:21:30 阅读数:2574 一.同时装了Python3和Python2,怎么区分 了解python的人都知道pyt ...

  7. 我的 Delphi 学习之路 —— Delphi 助手的安装

    标题:我的 Delphi 学习之路 -- Delphi 助手的安装 作者:断桥烟雨旧人伤 Delphi 助手的安装 CnWizards 类似于 VS 中的番茄助手,在编写 Delphi 代码时帮助极大 ...

  8. Zeta Linux上进行WiFi Direct调试

    1)叫醒p2p网卡 ifconfig p2p0 up   2)启动wpa_supplicant服务 wpa_supplicant -Dnl80211 -ip2p0 -c /etc/wpa_suppli ...

  9. 09-if判断语句

    https://www.liaoxuefeng.com/  廖雪峰的官方网站 hm_01_判断年龄.py 1 #!/usr/bin/env python3 # coding=utf-8 def mai ...

  10. PICT工具一键生成正交试验用例

    PICT工具一键生成正交试验用例 作用: 1.解决手动设计大量测试用例.或覆盖不全面问题,提高测试效率 2.读取excel,将生成的参数组合自动带入脚本,进行接口自动化测试 一.PICT简介 PICT ...