You can't specify target table 'table' for update in FROM clause
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的更多相关文章
- mysql中更新或者删除语句中子语句不能操作同一个表You can't specify target table 'test' for update in FROM clause
		
问题描述:有个数据表test,有个字段value,如下 mysql> select * from test;+----+------------------------------------+ ...
 - 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 ...
 - 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 ...
 - 错误: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 ...
 - [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 ...
 - 【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 原因 待更新/删除的数据集与查询的 ...
 - 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 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 ...
 - 关于mysql 5.7版本“报[Err] 1093 - You can't specify target table 'XXX' for update in FROM clause”错误的bug
		
不同于oracle和sqlserver,mysql并不支持在更新某个表的数据时又查询了它,而查询的数据又做了更新的条件,因此我们需要使用如下的语句绕过: , notice_code ) a) ; 本地 ...
 - 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 现为了查 ...
 
随机推荐
- Java抽象与接口的区别
			
Java抽象与接口的区别 答案方式一.简单来说,1.接口是公开的,里面不能有私有的方法或变量,是用于让别人使用的,而抽象类是可以有私有方法或私有变量的, 2.另外,实现接口的一定要实现接口里定义的所有 ...
 - [git] Git in Practice
			
Work flow with git and github Work with Remotes Check the current status git status Check the latest ...
 - POJ 3487 The Stable Marriage Problem(稳定婚姻问题 模版题)
			
Description The stable marriage problem consists of matching members of two different sets according ...
 - lintcode-39-恢复旋转排序数组
			
39-恢复旋转排序数组 给定一个旋转排序数组,在原地恢复其排序. 说明 什么是旋转数组? 比如,原始数组为[1,2,3,4], 则其旋转数组可以是[1,2,3,4], [2,3,4,1], [3,4, ...
 - 【week6】用户数
			
小组名称:nice! 小组成员:李权 于淼 杨柳 刘芳芳 项目内容:约跑app alpha发布48小时以后用户数如何,是否达到预期目标,为什么,是否需要改进,如何改进(或理性估算). 首先我们的app ...
 - 第四部分shell编程5项目二分发系统
			
第一部分:expect讲解expect可以让我们实现自动登录远程机器,并且可以实现自动远程执行命令.当然若是使用不带密码的密钥验证同样可以实现自动登录和自动远程执行命令.但当不能使用密钥验证的时候,我 ...
 - 伟大的淘宝IP库的API接口竟然提示503挂掉了
			
1 淘宝IP库惊现503错误 吃完晚饭,大概6点半了,天色已暗,太阳早就落山了.回到宿舍打开博客一看,傻眼了:博客每篇文章的评论者的地理信息全部处于“正在查询中……”的状态.这神马情况,不会是被淘宝封 ...
 - python 爬虫每天定时启动爬虫任务
			
# coding=utf-8 import datetime import time def doSth(): # 这里是执行爬虫的main程序 print '爬虫要开始运转了....' ...
 - 封装字符串的Format操作
			
相信即使再讨厌MFC的朋友也不会把厌恶牵扯到CString类上,而且CString现在也提升为ATL和MFC的共享类.用CString类,当然不能忘记它的Format方法,其用于格式化字符串.示例操作 ...
 - Sitemesh小记
			
一.前言 因参与公司框架改造,接触到了Sitemesh这个用于网页布局和修饰的框架,因之前没有接触过(汗颜),但是发现其小巧好用,便以此文记之~ 二.正文 Sitemesh有什么作用呢?我相信很多人在 ...