delete from table1 where
ID not in(select max(ID) ID from table1 group by row1) and
row1 in (select row1from table1 group by row1 having count(*) > 1)
# 出现错误
# You can't specify target table 't_zqqk_stockinfo_copy2' for update in FROM clause   不能从子句中指定目标表“TY-ZQQKYStknfOfCopy2”用于更新
delete from table1 where
ID not in(select ID from (select max(ID) ID from table1 group by row1) as t1) and
row1 in (select row1 from(select row1 from table1 groupby row1 havingcount(*) >1)as t2 )

子查询前再加一个子查询即可

You can't specify target table 'table' for update in FROM clause的更多相关文章

  1. mysql中更新或者删除语句中子语句不能操作同一个表You can't specify target table 'test' for update in FROM clause

    问题描述:有个数据表test,有个字段value,如下 mysql> select * from test;+----+------------------------------------+ ...

  2. mysql的一个特殊问题 you can't specify target table 'cpn_regist' for update in FROM clause

    今天在操作数据库的时候遇到了一个问题,sql语句如下: UPDATE cpn_yogurt_registration SET dep1Name = '1' WHERE `key` in  (SELEC ...

  3. Mysql update in报错 [Err] 1093 - You can't specify target table 'company_info' for update in FROM clause

    Mysql update in报错 解决方案: [Err] 1093 - You can't specify target table 'company_info' for update in FRO ...

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

  6. 【MySQL】解决You can't specify target table 'user_cut_record_0413' for update in FROM clause

    问题 You can't specify target table 'user_cut_record_0413' for update in FROM clause 原因 待更新/删除的数据集与查询的 ...

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

  8. MySQL中执行sql语句错误 Error Code: 1093. You can't specify target table 'car' for update in FROM clause

    MySQL中执行sql语句错误 Error Code: 1093. You can't specify target table 'car' for update in FROM clause 201 ...

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

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

  10. MySQL - 1093异常 - You can't specify target table 't' for update in FROM clause

    有一个表示地区的表,表结构与数据大概如下表. ID NAME PARENT_ID 1 中国 2 广东省 1 3 广州市 2 4 荔湾区 3 5 越秀区 3 6 番禺区 3 7 小谷围街道 6 现为了查 ...

随机推荐

  1. JQuery常用函数方法全集

    Attribute: $("p").addClass(css中定义的样式类型); 给某个元素添加样式 $("img").attr({src:"test ...

  2. 1.安装CDH5.12.x

    安装方式安装前准备安装步骤安装过程修改/etc/hosts设置ssh 互信修改linux 系统设置安装JDK1.8安装python2.7安装mysql/postgreysql数据库安装ntp设置本地y ...

  3. JS判断备忘

    快速引入jquery并显示重点内容 (function(d,j,s,t){t=d.body.appendChild(d.createElement("script"));t.onl ...

  4. MFC修改视图CView的背景颜色

    (1) 在CYournameView(就是你的视图类,以下以CDrawLineView为例)添加了一个背景颜色变量 COLORREF m_bgcolor; (2)修改这个函数: BOOL CDrawL ...

  5. python 爬虫 伪装

    #coding=utf-8 import requests def requests_view(response): import webbrowser requests_url = response ...

  6. [OS] 操作系统错题集

    1. (判断) 答案:错 缓冲区有两块:高速缓存区(物理存在)和磁盘缓存区(逻辑存在,实际是内存一块),都不在外存(硬盘). 2. 操作系统的功能:处理机管理(进程管理).作业管理.存储管理.设备管理 ...

  7. tcp协议的六个标识位

    6个标识位: URG 紧急指针,告诉接收TCP模块紧要指针域指着紧要数据. ACK 置1时表示确认号(为合法,为0的时候表示数据段不包含确认信息,确认号被忽略. PSH 置1时请求的数据段在接收方得到 ...

  8. 编写高效Lua代码的方法

    编写高效Lua代码的方法 翻译自<Lua Programming Gems>Chapter 2:Lua Performance Tips:Basic fact By Roberto Ier ...

  9. 【刷题】BZOJ 2179 FFT快速傅立叶

    Description 给出两个n位10进制整数x和y,你需要计算x*y. Input 第一行一个正整数n. 第二行描述一个位数为n的正整数x. 第三行描述一个位数为n的正整数y. Output 输出 ...

  10. BZOJ4518:[SDOI2016]征途——题解

    https://www.lydsy.com/JudgeOnline/problem.php?id=4518 https://www.luogu.org/problemnew/show/P4072 Pi ...