Mysql更新关联子查询报错
报错内容: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更新关联子查询报错的更多相关文章
- hbase.client.RetriesExhaustedException: Can't get the locations hive关联Hbase查询报错
特征1: hbase.client.RetriesExhaustedException: Can't get the locations 特征2: hbase日志报错如下:org.apache.zoo ...
- 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 ...
- 利用带关联子查询Update语句更新数据
Update是T-sql中再简单不过的语句了,update table set column=expression [where condition],我们都会用到.但update的用法不仅于此,真 ...
- mssql sql高效关联子查询的update 批量更新
/* 使用带关联子查询的Update更新 --1.创建测试表 create TABLE Table1 ( a varchar(10), b varchar(10), ...
- 为什么我的子线程更新了 UI 没报错?借此,纠正一些Android 程序员的一个知识误区
开门见山: 这个误区是:子线程不能更新 UI ,其应该分类讨论,而不是绝对的. 半小时前,我的 XRecyclerView 群里面,一位群友私聊我,问题是: 为什么我的子线程更新了 UI 没报错? 我 ...
- MySQL查询报错 ERROR: No query specified
今天1网友,查询报错ERROR: No query specified,随后它发来截图. root case:查询语法错误 \G后面不能再加分号;,由于\G在功能上等同于;,假设加了分号,那么就是;; ...
- 【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 ...
- 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 ...
- mysql开启慢查询报错:
1.进入mysql命令行:#mysql -uroot -p123456,执行下面的命令开启慢查询报错: set global slow_query_log=on; set global long_qu ...
随机推荐
- python 单例实现
class View: _instance = None def __new__(cls, *args, **kwargs): if cls._instance is None: cls._insta ...
- MVC系统过滤器 OutputCacheAttribute
命名空间: System.Web.Mvc程序集: System.Web.Mvc(在 System.Web.Mvc.dll 中) 一.MVC缓存简介 缓存是将信息(数据或页面)放在内存中以避免频繁的 ...
- SW:HTML DOM
1:节点:nodeType,nodeValue,nodeName getAttributeNode() 方法从当前元素中通过名称获取属性节点. 元素节点nodeValue是null,属性节点nodeV ...
- Ubuntu18.04格式化U盘为NTFS的方法
1.先安装工具ntfs-3g sudo apt-get install ntfs-3g 2.找到需要格式化的U盘在系统中的序号 df -h 找到U盘的序列号后记下来,例如“/dev/sdd1” 3.解 ...
- eclipse快速查看工程代码行数
1.点击要统计的项目或许文件夹,在菜单栏点击Search,然后点击File... 2.选中正则表达式(Regular expression),并在搜索文本框输入\n ;3.在文件名中输入*或*.jav ...
- 解决can't connect to redis-server
解决方案:编辑redis.conf配置文件:注释掉61行本地链接限制以及80行配置修改为no 61 # bind 127.0.0.1 80 protected-mode no 重启服务即可
- 基于注解的SpringMVC自定义DispatcherServlet配置
通过重载AbstractAnnotationConfigDispatcherServletInitializer实现类的customizeRegistration()方法来自定义DispatcherS ...
- php 7.3 新特性
2018-12-10 14:51:35 星期一 官方原文: https://github.com/php/php-src/blob/43329e85e682bed4919bb37c15acb8fb3e ...
- WPF 10天修炼 第七天- WPF资源、样式、控件模板
WPF资源 对象资源 WPF允许在XAML标记的任意位置定义资源.比如在特定的控件.窗口或应用程序级别定义资源,WPF资源系统提供的对象资源有如下好处: 1. 高效:使用对象资源可以在一个地方定义而 ...
- 【转载 | 笔记】IIS无法删除应该程序池 因为它包含X个应用程序
IIS无法删除应该程序池 因为它包含X个应用程序 今天代码主分支在vs2015创建了虚拟目录http://localhost/webapp指向的物理路径是E:\webapp 之后新开了一个分支把代码放 ...