在update mysql行上(您可以在FROM子句中为update指定目标表';x';)

在update mysql行上(您可以在FROM子句中为update指定目标表';x';),mysql,sql,Mysql,Sql,我正在尝试更新MySQL行 我的问题是 update x set available_material_id = null where id not in (select id from x where additional_info = 1); 我收到以下错误消息:您不能在FROM子句中为更新指定目标表“x” 有人能帮我解决这个问题吗 我使用的是MySQL版本5.6.38 我看到了这个答案,但我想不出答案。使用左连接: update x left join x xx

我正在尝试更新MySQL行

我的问题是

update x set available_material_id = null where id not in (select id from x where additional_info = 1);
我收到以下错误消息:您不能在FROM子句中为更新指定目标表“x”

有人能帮我解决这个问题吗

我使用的是MySQL版本5.6.38


我看到了这个答案,但我想不出答案。

使用
左连接:

update x left join
       x xx
       on x.id = xx.id and xx.additional_info = 1
    set available_material_id = null
    where xx.id is null;