今天写SQL的时候遇到一个坑爹的报错
You can’t specify target table ‘example_table’ for update in FROM clause
翻译:做变更的表不能做子查询
我的SQL语句是
delete from example_table where example_filed = (select example_filed from example_table …)
解决:
delete from example_table where example_filed = (select a.example_filed from (select example_filed from example_table …)a )
子查询外面多包了一层查询就行,大无语事件