you can't specify target table 'xx' for update in from | mysql 技术论坛-江南app体育官方入口
这个错误是因为mysql不允许在update语句中直接引用要更新的表。您可以通过使用子查询或者join来解决这个问题。以下是一个使用子查询的示例:
update t_user_info
set last_school = user_login_name
where uuid in (
select uuid
from (
select uuid
from t_user_info
where create_user_uuid = '3907e41c28164698af6d2c4c48431eb7'
) as subquery
);
或者执行
update
t_user_info
set
last_school = user_login_name
where
uuid in (
select
uuid
from
(
select
uuid
from
t_user_info
where
create_user_uuid = '3907e41c28164698af6d2c4c48431eb7') as cc);
本作品采用《cc 协议》,转载必须注明作者和本文链接