1093 - You can't specify target table 'hardware' for update in FROM clause

背景

今天想删除历史自动化创建的数据
好家伙执行sql提示了:
1093 - You can't specify target table 'hardware' for update in FROM clause

我写的sql:
DELETE from tb1 where id in (select id from tb1 where num='123')

解决办法

delete from tb1 where id in   (
           select id from (
                       select id from tb1 where num='123'
                           ) as tmp
); 
posted @ 2022-09-23 15:41  Tarzen  阅读(38)  评论(0)    收藏  举报