MySQL 中 You can't specify target table '表名' for update in FROM clause错误解决办法
在MySQL中,写SQL语句的时候 ,可能会遇到You can't specify target table '表名' for update in FROM clause这样的错误,它的意思是说,不能先select出同一表中的某些值,再update这个表(在同一语句中),即不能依据某字段值做判断再来更新某字段的值。
问题解决
将SELECT出的结果再通过中间表SELECT一遍,这样就规避了错误。
UPDATE t_e_mail_simplify
SET is_seen = '0'
WHERE
mail = 'jenny@echemi.com'
AND uid IN (
SELECT
a.uid
FROM
(
SELECT
uid
FROM
t_e_mail_simplify
WHERE
mail = 'jenny@echemi.com'
AND folder = 'INBOX'
AND is_seen = 1
) a
)
MySQL 中 You can't specify target table '表名' for update in FROM clause错误解决办法的更多相关文章
- [转]MySQL 中 You can't specify target table '表名' for update in FROM clause错误解决办法
原文链接:https://blog.csdn.net/qq_29672495/article/details/72668008
- Mysql - You can't specify target table '表名' for update in FROM clause 错误解决办法
背景 在MySQL中,写SQL语句的时候 ,可能会遇到 You can't specify target table '表名' for update in FROM clause 这样的错误 错误含义 ...
- MySQL中You can't specify target table '表名'('sn_app_label') for update in FROM clause错误解决办法
在有些时候有级联关系的数据放在了同一张表中,在写sql语句的时候可能会遇到这样的场景:我要插入两条数据,第一条是父节点,第二条是子节点,关联关系是父节点的自增长id:在写这样的sql语句时有可能就会出 ...
- 【mysql 】sql删除重复记录 You can't specify target table '表名' for update in FROM clause
用下面的语句就报语法出错: delete from tab_record where recordid not in (select min(c.recordid) as recordid from ...
- 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出同一表中的某些值 ...
- 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这个表( ...
- 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出同一表中的某些值 ...
- Mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表(在同一语句中)。
将select出的结果再通过中间表select一遍,这样就规避了错误.注意,这个问题只出现于mysql,mssql和oracle不会出现此问题. mysql中You can't specify tar ...
- MySQL--mysql中You can’t specify target table for update in FROM clause错误解决方法
参考:http://www.jb51.net/article/60926.htm mysql中You can't specify target table for update in FROM cla ...
随机推荐
- C# winform 记住密码实现代码
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- .net core2.2 跨域
Startup.cs 类 ConfigureServices中 //允许一个或多个具体来源: services.AddCors(options => { // Policy 名稱 CorsPol ...
- .NET Core 玩一玩 Ocelot API网关
.net 这几年国内确实不好过. 很多都选择转行.不过.net Core跨平台 开源之后 .社区的生态在慢慢建立.往好的趋势发展. 对于坚守在.NET战线的开发者来说 是个挺不错的消息. 特别是微软 ...
- Day 33 Socket编程.
套接字 (socket)处使用 基于TCP 协议的套接字 TCP 是基于链接的 ,服务器端和客户端启动没有顺序. 服务器端设置: import socket sk =socket.socket() # ...
- SpingBoot的认识和基本使用
认识SpingBoot Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化Spring应用的初始搭建以及开发过程. -使用springboot以后,搭建一个spring应 ...
- Django 使用getattr() 方法获取配置文件的变量值
在django项目的开发过程中,有时需要获取配置文件里的变量值,可以通过下面这样的方式去进行获取 from django.conf import settings item = getattr(set ...
- Java并发工具类之并发数控制神器Semaphore
Semaphore(信号量)使用来控制通知访问特定资源的线程数量,它通过协调各个线程,以保证合理的使用公共资源. 我们可以这么理解Semaphore,比如一个厕所只有6个坑,同时只能满足6个人上厕所( ...
- jmeter-linux下运行
1.2 在命令行下运行脚本 将1.1中的脚本保存,在编辑是随时可以保存,保存后是一个jmx格式的文件(如图),这个就是要在命令行下运行的脚本(作为参数运行).这个脚本文件可以不包含1.1中第四和第五步 ...
- Postman+Newman+Jenkins 详细教程
详细步骤点击: https://note.youdao.com/web/#/file/WEBda9492a77807d8050b40f8315bf6554a/note/WEBde553e6dff6ff ...
- POJ 1287
#include<iostream> #include<stdio.h> #define MAXN 100 #define inf 1000000000 using names ...