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 ...
随机推荐
- WPF选择文件、文件夹和另存为对话框
WPF提供了选择文件对话框,但并没有提供选择文件夹的对话框. OpenFileDialog类存在于PresentationFramework.dll程序集. public string SelectF ...
- .net core cache使用
整理下.net core cache的使用 Nuget安装 Microsoft.Extensions.Caching.Memory using Microsoft.Extensions.Cachi ...
- .net程序中http请求的超时配置
请求时的超时 // // 摘要: // 获取或设置 System.Net.HttpWebRequest.GetResponse() 和 System.Net.HttpWebRequest.GetReq ...
- celery_消息队列
http://www.cnblogs.com/wupeiqi/articles/8796552.html 一. celery 简介 Celery 是一个专注于实时处理和任务调度的分布式任务队列, 同时 ...
- Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'img' at row 1故障
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'img' at ro ...
- Youke365_2_4 一处Sql注入漏洞以及一处任意文件删除
本文作者:X_Al3r Prat 0 自白 每一天都是新的一天.没啥吐槽的,步入正题 /system/category.php 文件一处Sql注入## 80-87行代码 $root_i ...
- Python中获取当前时间 获取当前时间前几天的代码
当然 需要引入 datetime import datetime 获取当前日期:datetime.datetime.now().strftime('%Y-%m-%d') 获取当前日期前七天日期: no ...
- 访问www.baidu.com后会发生什么(一次完整的网络通讯过程)
1.在浏览器中输入www.baidu.com 这意味着浏览器要向百度发送一个网页数据包,要发送数据包,需要知道对方的IP地址,这里我们只知道网址为www.baidu.com,却不知道IP地址,此时应用 ...
- 《Vue 编程房内考》
古人有云:码农爱coding,则为之计深远. 众人问:何为之? 古人曰:底层.算法和架构. 众木然. 古人又曰:多看源码. 以下内容是我在学习 Vue-2.5.2 源码时的一个总结. 第一章 活捉Vu ...
- 微信小程序redirect 到tab不刷新
// 更新2018/11/20:现在小程序的页面栈长度为10 更正 2018/11/20: 经过一段时间的实践,我发现以前方法存在很多问题,比如 getCurrentPages 方法并不在官方的 AP ...