【处理】Table is specified twice, both as a target for 'UPDATE' and as a separate source for data

【错误内容】:Error Code: 1093. Table '表名' is specified twice, both as a target for 'UPDATE' and as a separate source for data

【错产生经过】:update t_test1 set col1= col1_value where val1 in(select val1 from t_test2 group by val1);

【解决办法】:update t_test1 set col1= col1_value where val1 in(select * from (select val1 from t_test2 group by val1) as T);

注意:经测试delete时,也存在这种情况

你可能感兴趣的:(MariaDB)