我想用各自的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的新手。
答案 0 :(得分:3)
在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;