mysql uodate 报错 You can't specify target table '**' for update in FROM clause
You can't specify target table 'sc' for update in FROM clause
背景:把“sc”表中“叶平”老师教的课的成绩都更改为此课程的平均成绩;

上面的sql是我写的,执行就报这个错,这个原因说的是 不能从自己表里查数据再更新自己
解决方法:嵌套一层中间表
update sc set sc.score =
(select t1.score from (select avg(sc1.score) score from sc sc1 where sc1.c_id=(select course.c_id from teacher,course where course.t_id=teacher.t_id and tname='叶平')) t1)
where sc.c_id = (select course.c_id from teacher,course where course.t_id=teacher.t_id and tname='叶平');
这种问题仅存在于mysql中,在Oracle中是不存在的,因此在此打个mark 以防下次又忘记了
mysql uodate 报错 You can't specify target table '**' for update in FROM clause的更多相关文章
- mysql中You can't specify target table for update in FROM clause
使用mysql在删除表中重复记录 delete from user where username in (select user name form(select username from user ...
- mysql错误:1093-You can’t specify target table for update in FROM clause的解决方法
update语句中包含的子查询的表和update的表为同一张表时,报错:1093-You can’t specify target table for update in FROM clause my ...
- mysql出现You can’t specify target table for update in FROM clause
在mysql执行下面语句时报错: You can’t specify target table for update in FROM clause UPDATE edu_grade_hgm_1 ' W ...
- 解决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 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 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 for update in FROM clause错误解决方法,需要的朋友可以参考下 MySQL中You c ...
- MySQL 出现You can't specify target table for update in FROM clause错误解决方法
MySQL出现You can’t specify target table for update in FROM clause 这个错误的意思是不能在同一个sql语句中,先select同一个表的某些值 ...
- MYSQL 1093 之You can't specify target table for update in FROM clause解决办法
You can't specify target table for update in FROM clause含义:不能在同一表中查询的数据作为同一表的更新数据. 出现以上错误,是因为想将表自身的字 ...
随机推荐
- windows环境下curl 安装和使用
原文:https://blog.csdn.net/qq_21126979/article/details/78690960?locationNum=10&fps=1 一.curl 安装 cur ...
- Mysql 反向解析 导致远程访问慢
在云端部署了mysql后,发现远程连接的响应速度非常慢(3-10s) 但是在本地访问数据库却没有问题 经过一番google这才知道原来mysql默认会进行反向解析,即通过ip地址反向向ISP申请获取域 ...
- GIt -- git push 远程分支老是需要重新输入公钥密码问题处理?
步骤: 先查看远程有哪些分支 删除远程分支,重新关联远程分支 最后再git push 到远程分支 git remote -v git remote rm RedisNote git remote a ...
- oracle,mysql,sql server三大数据库的事务隔离级别查看方法
1:mysql的事务隔离级别查看方法 mysql 最简单,执行这条语句就行:select @@tx_isolation 详情: 1.查看当前会话隔离级别 select @@tx_isolation; ...
- 洛谷P4770 [NOI2018]你的名字 [后缀自动机,线段树合并]
传送门 思路 按照套路,直接上后缀自动机. 部分分:\(l=1,r=|S|\) 首先把\(S\)和\(T\)的后缀自动机都建出来. 考虑枚举\(T\)中的右端点\(r\),查询以\(r\)结尾的串最长 ...
- java内部类:成员内部类,静态内部类方法内部类,匿名内部类(A)
package cn.kecheng; /** * 在java中,一个文件可以定义多个类,文件名必须和public 类型的类的类名保持一致.这两个类是平行关系. * 在java中,一个类也可以定义在一 ...
- Scyther-manual ------BNF
1.Scyther 协议安全模型的验证实例 第一部分: 打开协议模型 ,设置攻击变量的参数执行分析 Scyther is a tool for the formal analysis o the ...
- el-table中单数行与双数行设置不同的背景颜色
<el-table :cell-style='cellStyle' :data="tableData" style="width: 100%;" > ...
- CentOS Linux Jenkins安装、部署、更新
1.安装:https://wiki.jenkins.io/display/JENKINS/Installing+Jenkins+on+Red+Hat+distributions2.部署: 注意事项: ...
- BLO(bzoj1123)
Description Byteotia城市有n个 towns, m条双向roads. 每条 road 连接 两个不同的 towns ,没有重复的road. 所有towns连通. Input 输入n和 ...