您好,我试试这个:
UPDATE SET managedBy_id=(SELECT id FROM users as managedBy_id WHERE login=123456) WHERE login=72584;
输出是: 错误代码:1093。您无法指定目标表'用户'用于FROM子句0.000秒的更新
答案 0 :(得分:0)
您的UPDATE
声明错误,请将其修改为
UPDATE users
SET managedBy_id = CASE WHEN login=123456 THEN id ELSE managedBy_id END
WHERE login=72584;