Mysql 错误代码:1093。表';网站html';指定两次,都作为';更新';并作为单独的数据源

Mysql 错误代码:1093。表';网站html';指定两次,都作为';更新';并作为单独的数据源,mysql,sql,Mysql,Sql,我想用相应的id更新表的“status”列,但这会导致错误代码1093。 下面是我的SQL查询 Update site_html Set status='Update Found' Where id = ( select id from site_html where link='http://www.example.com'); 如何更正此错误?我是SQL新手 在MySQL中,不能直接修改SELECT部分中使用的相

我想用相应的id更新表的“status”列,但这会导致错误代码1093。 下面是我的SQL查询

Update site_html Set status='Update Found' 
Where id = (
            select id 
            from site_html
            where link='http://www.example.com'); 

如何更正此错误?我是SQL新手

在MySQL中,不能直接修改SELECT部分中使用的相同表名。因此,您可以通过表别名执行此操作

update site_html AS s, (select id  from site_html where link='http://www.example.com') AS t
set status='Update Found' 
where s.id = t.id;
我猜您的答案是:**或者:**您的查询似乎与MySQL standarts不匹配。当然,这项任务还有一些变通办法。