报错内容:sql  1093 - You can't specify target table 'u' for update in FROM clause

错误原因: if you're doing an UPDATE/INSERT/DELETE on a table, you can't reference that table in an inner query

解决方法: (you can however reference a field from that outer table...)

错误的sql语句

 update gg_platform_navtree u set u.pid = (select id from gg_platform_navtree s where s.pid = u.pid and s.isleaf = 0 ) where u.isleaf = 1;

通过解决方案转换后的sql语句

update gg_platform_navtree u set u.pid = (select id from (select * from gg_platform_navtree) s where s.pid = u.pid and s.isleaf = 0 ) where u.isleaf = 1;

 

Mysql更新关联子查询报错的更多相关文章

  1. hbase.client.RetriesExhaustedException: Can't get the locations hive关联Hbase查询报错

    特征1: hbase.client.RetriesExhaustedException: Can't get the locations 特征2: hbase日志报错如下:org.apache.zoo ...

  2. mysql(5.7以上)查询报错:ORDER BY clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by

    执行mysql命令查询时: select * from table_name错误信息如: [Err] 1055 - Expression #1 of ORDER BY clause is not in ...

  3. 利用带关联子查询Update语句更新数据

    Update是T-sql中再简单不过的语句了,update table set column=expression  [where condition],我们都会用到.但update的用法不仅于此,真 ...

  4. mssql sql高效关联子查询的update 批量更新

    /* 使用带关联子查询的Update更新     --1.创建测试表 create TABLE Table1     (     a varchar(10),     b varchar(10),   ...

  5. 为什么我的子线程更新了 UI 没报错?借此,纠正一些Android 程序员的一个知识误区

    开门见山: 这个误区是:子线程不能更新 UI ,其应该分类讨论,而不是绝对的. 半小时前,我的 XRecyclerView 群里面,一位群友私聊我,问题是: 为什么我的子线程更新了 UI 没报错? 我 ...

  6. MySQL查询报错 ERROR: No query specified

    今天1网友,查询报错ERROR: No query specified,随后它发来截图. root case:查询语法错误 \G后面不能再加分号;,由于\G在功能上等同于;,假设加了分号,那么就是;; ...

  7. 【mybatis】【mysql】mybatis查询mysql,group by分组查询报错:Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column

    mybatis查询mysql,group by分组查询报错:Expression #1 of SELECT list is not in GROUP BY clause and contains no ...

  8. myBatis查询报错 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near

    myBatis查询报错 You have an error in your SQL syntax; check the manual that corresponds to your MySQL se ...

  9. mysql开启慢查询报错:

    1.进入mysql命令行:#mysql -uroot -p123456,执行下面的命令开启慢查询报错: set global slow_query_log=on; set global long_qu ...

随机推荐

  1. 域 搭建OU 组织单元

    以这个界面开始操作: 在 baidu.com 右键---新建----组织单位----北京分公司 在 baidu.com 右键---新建----组织单位----北京分公司 在北京分公司 和南京分公司下面 ...

  2. Visual Studio Shortcuts

    https://docs.google.com/file/d/0Bw8aEjCQGEquMjRaWFBKUUtuRE0/edit

  3. 自适应rem.js

    用rem.js来实现自适应屏幕大小,要注意border不用rem做单位  代码如下: (function (doc, win) { //orientationchange : 判断手机是水平方向还是垂 ...

  4. CDH5.16.1的maven依赖版本查询地址

    1查询官网地址,提供了详细的各个版本的jar依赖版本信息 https://www.cloudera.com/documentation/enterprise/release-notes/topics/ ...

  5. MySQL命令行查询乱码解决方法

    转自Agoly的博客,原文链接https://www.cnblogs.com/qmfsun/p/4846467.html 感谢博主Agoly这篇文章说的很详细很透彻. MySQL会出现中文乱码的原因不 ...

  6. LOJ #6485 LJJ 学二项式定理

    QwQ LOJ #6485 题意 求题面中那个算式 题解 墙上暴利 设$ f(x)=(sx+1)^n$ 假设求出了生成函数$ f$的各项系数显然可以算出答案 因为模$ 4$的缘故只要对于每个余数算出次 ...

  7. CSS3 Flex布局

    Flex 用于使页面上的内容自适应屏幕 首先,在网页代码的头部,加入一行viewport元标签. <meta name=”viewport” content=”width=device-widt ...

  8. 软件测试-培训的套路-log3

    最新的套路!我是没了解过--下图中描述-log3 Dotest-董浩 但是我知道不管什么没有白吃的午餐而且还会给钱…如果真的有,请醒醒! 当然话又回来,套路不套路,关键看你是否需要:你如果需要我觉得是 ...

  9. 2018-2019-2 网络对抗技术 20165337 Exp3 免杀原理与实践

    基础问题回答 (1)杀软是如何检测出恶意代码的? 基于特征码的检测:特征码就是一段数据.如果一个可执行文件(或其他运行的库.脚本等)包含特定的数据则被认为是恶意代码.AV软件厂商要做的就是尽量搜集最全 ...

  10. 入坑DL CV 一些基础技能学习

    进入实验室学习了一个月左右,记录一下新手入门所学的基本知识,都是入门级别的教程 1.Python 快速入门:廖雪峰Python教程--> https://www.liaoxuefeng.com/ ...