I was using subquery in a delete sql. like this
DELETE FROM mytable WHERE id IN (SELECT ... FROM mytable);
First, my subquery return some ids, and then I run delete sql to delete these records from a table with these ids.
Due to my subquery also select from the table that I run the delete sql.
I got this error message.
You can't specify target table 'mytable' for update in FROM clause.
I can always run the select query first and then run the delete query with the select query's result.
But is there a simple mysql subquery solution here?
Thanks a lot.