为了修复节点表某批次数据的用户数据,做出了以下尝试:
UPDATE zs_work_approval_node SET uid = 4963, name = '苏畅' WHERE id IN (SELECT id FROM zs_work_approval_node  WHERE uid = 4967 AND STATUS IN (0, 1, 4));
执行:[Err] 1093 - You can't specify target table 'zs_work_approval_node' for update in FROM clause

百度查询提示得知:

update语句中包含的子查询的表和update的表为同一张表时,报错:1093-You can’t specify target table for update in FROM clause

mysql不允许update目标表和子查询里面的表为同一张表

解决办法: 利用子查询sql可以改变双层的子查询,即可执行成功  (但性能较差,仅仅适合较小的数据量的)

UPDATE zs_work_approval_node SET uid = 4963, name = '苏畅' WHERE id IN (SELECT * FROM ( SELECT m.id FROM zs_work_approval_node m WHERE uid = 4967 AND STATUS IN (0, 1, 4)) AS temp);

mysql 1093 - You can't specify target table 'xx表' for update in FROM clause的更多相关文章

  1. MySQL 1093 - You can't specify target table 'sc' for update in FROM clause

    错误代码如下: #(8) 把"邓维杰"同学的成绩全部删除. SELECT * FROM sc WHERE EXISTS(SELECT * FROM student WHERE st ...

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

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

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

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

  5. mysql用查询结果当删除的判断条件进行删除报错1093 You can't specify target table解决方法

    mysql用查询结果当删除的判断条件进行删除报错1093 You can't specify target table解决方法 #分开两个sql执行正常的语句,只保留最新1000条数据,删掉1000条 ...

  6. MySQL 出现You can't specify target table for update in FROM clause错误解决方法

    MySQL出现You can’t specify target table for update in FROM clause 这个错误的意思是不能在同一个sql语句中,先select同一个表的某些值 ...

  7. mysql 出现You can't specify target table for update in FROM clause错误的解决方法

    mysql出现You can’t specify target table for update in FROM clause 这个错误的意思是不能在同一个sql语句中,先select同一个表的某些值 ...

  8. MySQL中You can't specify target table for update in FROM clause一场

    mysql中You can't specify target table <tbl> for update in FROM clause错误的意思是说,不能先select出同一表中的某些值 ...

  9. mysql中You can’t specify target table for update in FROM clause错误解决方法

    mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表( ...

随机推荐

  1. Maven系列(二)exec-maven-plugin

    Maven系列(二)exec-maven-plugin 1. mvn 命令行运行 # exec:java 不会自动编译代码,你需要手动执行 mvn compile 来完成编译 mvn compile ...

  2. action spring 注入错误,如果检查各项注入都没有错误时,考虑struts 是否配置了namespace(如果你有多个namespace="/")

    [ERROR] 2015-01-04 09:42:35,180 (CommonsLogger.java:38) - Exception occurred during processing reque ...

  3. 2014.1.4 cxf spring webservice

    先创建 webservice 服务端 . 首先下载 cxf jar 包 , cxf-2.7.8 . 新建 web 项目 aa . 将下载的cxf 压缩文件解压,将lib 下的jar 全部build p ...

  4. Warning: Attempt to present A on B whose view is not in the window hierarchy!

    昨天写豆瓣发广播Demo的时候,为了写Demo的简单,就使用了Storyboard,结果执行视图跳转时遇到了这个问题: Warning: Attempt to present <UINaviga ...

  5. jquery ajax 为什么会 多次请求

    因你绑定的时间会随着你调用的地方增加而增加的,jquery 就是有这样的现象,举个例子让你解决吧,如果有个地方$('#Id').click(function(){ $.ajax({})})这样用对吧, ...

  6. JAVA开发常用计算机命令

    系统常用命令 win+r > control (可进入控制面板,管理工具,服务) win+r > cmd > systeminfo (x86-based 指32位系统,x86-64 ...

  7. [译]Autoprefixer:一个以最好的方式处理浏览器前缀的后处理程序

    Autoprefixer解析CSS文件并且添加浏览器前缀到CSS规则里,使用Can I Use的数据来决定哪些前缀是需要的.   所有你需要做的就是把它添加到你的资源构建工具(例如 Grunt)并且可 ...

  8. 对Spring 容器管理事务支持的总结

    1.问题 Connection conn = DataSourceUtils.getConnection(); //开启事务 conn.setAutoCommit(false); try { Obje ...

  9. mdadm详细使用手册

    1. 文档信息 当前版本 1.2 创建人 朱荣泽 创建时间 2011.01.07 修改历史 版本号 时间 内容 1.0 2011.01.07 创建<mdadm详细使用手册>1.0文档 1. ...

  10. .NET 调试入门(三)常用的命令

    windbg ANSI Command Tree 1.0 title {"Crash Dump Analysis Checklist"} body {"Crash Dum ...