You can’t specify target table ‘表名’ for update in FROM clause

意思是 不能先select出同一表中的某些值,再update这个表

原SQL语句:

update push_to_cloud
set is_confirm = 1 , direction = 1
where student_code = 01
and `snap_time`= (select max(`snap_time`)from push_to_cloud )

出现这种情况,只需要通过中间表select一遍就可以了。

解决办法:

update push_to_cloud
set is_confirm=1,direction=1
WHERE student_code = 01
and `snap_time` =(select a.time from (select MAX(snap_time) time from push_to_cloud ) a )

如果出现

Every derived table must have its own alias

检查是不是没有给表取别名

Mysql:You can't specify target table for update in FROM clause的解决办法相关推荐

  1. mysql 1093 you can_mysql中错误:1093-You can’t specify target table for update in FROM clause的解决方法...

    发现问题 最近在处理一些数据库中数据的时候,写了下面的这一条sql语句: UPDATE f_student SET school_id = 0 WHERE id > ( SELECT id FR ...

  2. mysql错误:1093-You can’t specify target table for update in FROM clause的解决方法

    在做更新操作的时候,赋值操作用了子查询,这个时候Mysql就报了如标题的错误. 解决方法:子查询需要再包裹一层 把他当成一个新表 然后通过新表查询出来的值 来赋值. 这个方法只适用于你的查询和更新操作 ...

  3. MySQL 1093 You can't specify target table for update in FROM c 的解决办法

    执行SQL语句时出现这个错误.原因是在更新这个表和数据时又查询了它,而查询的数据又做了更新的条件. 以前ORACLE上面没有这个错误.DELETE FROM comments WHEREid = (S ...

  4. MYSQL之You can't specify target table for update in FROM clause解决办法

    MYSQL之You can't specify target table for update in FROM clause解决办法 2016年12月21日 15:24:23 阅读数:19272 这篇 ...

  5. mysql修改重复数据You can‘t specify target table ‘‘ for update in FROM clause

    You can't specify target table '' for update in FROM clause 得修改成下边的写法 update 景区与景区表 set 距离='',驾车时间=' ...

  6. You can't specify target table for update in FROM clause

    今天使用mysql,写出一个sql语句: update service_re set is_deleted=0 where id=(select id from service_re where p_ ...

  7. 【sql】You can‘t specify target table for update in FROM clause

    今天写mysql的时候出现了You can't specify target table for update in FROM clause问题,错误的意思是说,不能先select出同一表中的某些值, ...

  8. Mysql 错误 Code: 1093. You can't specify target table for update in FROM clause

    You can't specify target table 'recharge_log' for update in FROM clause 这个问题出现的情况是: 更新一个表的数据时,where条 ...

  9. MySQL异常一之: You can‘t specify target table for update in FROM clause解决办法

    文章目录 前言 一.bug描述 二.需求描述 三.错误做法 四.正确写法 1. 正确 sql 2. sql 片段解释: 前言 总结SQL中的bug问题 一.bug描述 You can't specif ...

最新文章

  1. 9000+ 字,彻底征服 Spring AOP ,美滋滋
  2. 解题报告:hdu 1276 士兵队列训练问题 - 简单题
  3. 安卓应用安全指南 4.8 输出到 LogCat
  4. 如何从外网向内网传东西_鱼缸内出现气泡还会不断缓缓升起,是什么东西,如何处理和解决?...
  5. 字符串单词翻转c语言,C语言反转一行字符串单词示例
  6. python有哪些用途-python是什么?python的用途
  7. 机器学习案例系列教程——距离度量方法总结
  8. 域名注册管理相关的三个机构:ICAAN、interNIC、CNNIC
  9. 【GPU加速】笔记本双显卡如何切换
  10. mzy,struts学习(二):struts.xml的配置
  11. Hadoop HA 高可用
  12. linux777命令,linux权限777 命令是什么意思
  13. poj 1284 Primitive Roots 求素数元根数
  14. 谷歌浏览器好用的复制粘贴插件_好用到炸的谷歌chrome浏览器必备扩展插件(一)...
  15. 数据库面试——锁的12连问,赶紧收藏!
  16. 倍福--CAB文件的配置
  17. 已知由单链表表示的线性表中含有三类字符(数字,字母和其他字符)试编写算法来构造三个循环链表,使每个表中只含某一类字符,且利用原表中的结点空间作为这三个表的结点空间,头结点可另辟空间。
  18. 数据挖掘实战(6)——机器学习实现文本分类(今日头条tnews数据集)
  19. 将Excel表格数据转为SQL语句
  20. 如何搭建Git服务器

热门文章

  1. oracle匹配靓号的正则表达式_靓号正则表达式匹配 疑问
  2. Can‘t resolve ‘element-plus/lib/el-button‘报错
  3. Change maker problem-找零(1-99美分)
  4. 8088微处理器主要引线
  5. Mini-batch 梯度下降 与Tensorflow中的应用
  6. opencv中的各种滤波函数
  7. Linux磁盘 - fdisk,partprobe, mkfs, mke2fs, fsck, badblocks, mount, mknod
  8. 盘点分布式文件存储系统____分布式文件存储系统简介
  9. 11.孩子被欺负了怎么办?
  10. [WIN32]Win7软件部署清单