错误1093 Mysql

时间:2015-10-05 20:25:05

标签: mysql sql

  

您好,我试试这个:

 UPDATE SET managedBy_id=(SELECT id FROM users  as managedBy_id WHERE login=123456) WHERE login=72584; 
  

输出是:     错误代码:1093。您无法指定目标表'用户'用于FROM子句0.000秒的更新

1 个答案:

答案 0 :(得分:0)

您的UPDATE声明错误,请将其修改为

UPDATE users 
SET managedBy_id = CASE WHEN login=123456 THEN id ELSE managedBy_id END
WHERE login=72584;