表名被指定两次,作为更新的目标和单独的数据源 [英] Table name specified twice both as a target for update and separate source for data

查看:45
本文介绍了表名被指定两次,作为更新的目标和单独的数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Update table 
Set class = 0 
Where TOTAL_HOURS = (SELECT min (TOTAL_HOURS) from tutions);

产生的错误:

表名被指定两次,作为更新目标和单独的数据源.

Table name specified twice both as a target for update and separate source for data.

我该如何解决这个问题?

How can I fix this?

推荐答案

我猜你是想用教程更新教程.

I am guessing you are trying to update tutions with tutions.

做一个嵌套的子查询,让 MySQL 物化它,不再是同一张表.

Make a nested subquery so that MySQL materializes it and is no longer the same table.

试试这个:

Update tutions
Set class = 0 
Where TOTAL_HOURS = (select * from (SELECT min (TOTAL_HOURS) from tutions) t);

这篇关于表名被指定两次,作为更新的目标和单独的数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆