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这个表(在同一语句中),即不能依据某字段值做判断再来更新某字段的值.解决办法就是建立个临时的表.
随机推荐
- 使用Mybatis连接到Mysql报错,WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be esta
在Eclipse中使用springboot整合Mybatis,连接到5.7版本Mysql报错WARN: Establishing SSL connection without server's ide ...
- shell习题第6题:监听80端口
[题目要求] 写一个脚本,判断本机的80端口(加入服务为httpd)是否开启,如果开启就什么都不做,如果发现端口不存在,那么重启一下httpd服务,并发邮件通知相关人员 [核心要点] 检测80端口使用 ...
- MySQL----MySQL数据库入门----第四章 单表查询
select [distinct] * | 字段1,字段2,字段3... from 表名 [where 条件表达式] [group by 字段名] [having 条件表示式] [order by 字 ...
- php 实现重定向的三种方式
header()函数; header('location:http://www.baidu.com'); meta标签; echo '<meta http-equiv="refresh ...
- pomelo 的一些监控和维护插件(工具)
POMELO 提供了非常多的插件,可以方便我们日常对其的一些操作和开发工作,同样的我们也可以自己开发一些定制的插件让其伴随整个POMELO的生命周期运作(这里 不是要介绍如何制作POMELO插件),这 ...
- hive 优化 (转)
Hive优化 Hive优化目标 在有限的资源下,执行效率更高 常见问题 数据倾斜 map数设置 reduce数设置 其他 Hive执行 HQL --> Job --> Map/Reduce ...
- Python enumerate()方法
for循环中如果要获取当前元素的索引值,一个方法是定义一个计数器,每次取值的时候将这个值加一,如果是列表的话可以用index()函数,而python中有一个比较简洁的方法而已直接获得索引值,并可以方便 ...
- JAVA乐观锁实现-CAS
是什么 全称compare and swap,一个CPU原子指令,在硬件层面实现的机制,体现了乐观锁的思想. JVM用C语言封装了汇编调用.Java的基础库中有很多类就是基于JNI调用C接口实现了多线 ...
- echarts x轴文字换行显示
xAxis : [ { splitLine:{show:false}, type : 'category', data : ['社交人际','沟通交流','心理认知','游戏玩耍','大小运动','生 ...
- 修改Tomcat控制台标题(转)
转载地址:https://blog.csdn.net/chanryma/article/details/46930729 背景:用控制台方式启动Tomcat,控制台的标题默认是"Tomcat ...