报错内容: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. XSS绕过<>进行测试

    大家都知道,普遍的防御XSS攻击的方法是在后台对以下字符进行转义:<.>.’.”,但是经过本人的研究发现,在一些特殊场景下,即使对以上字符进行了转义,还是可以执行XSS攻击的. 首先看一个 ...

  2. robot framework

    一.步骤 1.创建工程和测试套件 2.创建测试案例 3.写脚本,运行案例 4.查看运行结果 report报告主要是概括性的报告,总结案例执行情况.log报告是更为详细的案例步骤的报告. 二.RIDE工 ...

  3. jenkins+supervisor实现django项目的自动部署(ubuntu)

    没有安装supervisor的话首先安装supervisor, apt install upservisor 安装supervisor大概率会出现问题,不推荐,最好是用pip 安装, 注意python ...

  4. 动态解析xml,并生成excel,然后发邮件。

    直接贴代码了! DECLARE @CurrentServer NVARCHAR(100)DECLARE @CurrentDatabase NVARCHAR(100)DECLARE @CurrentLo ...

  5. 15行python代码,帮你理解令牌桶算法

    本文转载自: http://www.tuicool.com/articles/aEBNRnU   在网络中传输数据时,为了防止网络拥塞,需限制流出网络的流量,使流量以比较均匀的速度向外发送,令牌桶算法 ...

  6. k8s部署etcd数据库集群

    ⒈下载 https://github.com/etcd-io/etcd/releases ⒉解压 tar -zxvf etcd-v3.3.12-linux-amd64.tar.gz ⒊移动可执行文件及 ...

  7. 医学图像数据(三)——TCIA部分数据下载方式

    前为止,本人还没有找到不需要账号的就可以部分下载的方式,因此这里讲的是需要注册账号下载部分数据的方法. 注意:下载部分数据需要注册账号 注册账号网址:https://public.cancerimag ...

  8. Virtual Machine

    之前说到可以使用Assembly language来实现程序编写,把程序通过一个Assembler就可以得到计算机可以操作的二进制文件. 但是Assembly language依旧不适于编程,但怎么将 ...

  9. PHP常用函数大全500+

    php usleep() //函数延迟代码执行若干微秒. unpack() //函数从二进制字符串对数据进行解包. uniqid() //函数基于以微秒计的当前时间,生成一个唯一的 ID. time_ ...

  10. struts 学习03

    jdk下载: 使用注解: @ParenPackage(value="struts-default") @Namespace(value="/) @Action(value ...