输入banner图图片脚本导航/分类

mysql - sql报错You can't specify target table 'table_name' for update in FROM clause

from t_person where id in (select id from t_person where name = "hello");

然而却报错: You can‘t specify target table ‘t_person‘ for update in FROM clause

以下这篇博客( https://blog.csdn.net/qq_29672495/article/details/72668008 )给出了解决方式: 将SELECT出的结果再通过中间表SELECT一遍,这样就规避了错误。

更正如下:

delete from t_person where id in (select temp.id from (select id from t_person where name = "hello") temp);

 

mysql - sql报错You can't specify target table 'table_name' for update in FROM clause

标签:筛选   sdn   bsp   upd   mysq   报错   name   from   mysql