SQL:
Before google
DELETE FROM category WHERE id IN (
SELECT c.id as id FROM category c
LEFT JOIN category_translation t ON c.id = t.id
GROUP BY c.id
HAVING COUNT(t.lang) = 0)
);
--> error
After google
DELETE FROM category WHERE id IN (
SELECT id FROM (
SELECT c.id as id FROM category c
LEFT JOIN category_translation t ON c.id = t.id
GROUP BY c.id
HAVING COUNT(t.lang) = 0)
) tblId
);
--> success
Thank to: http://verysimple.com/2011/03/30/mysql-cant-specify-target-table-for-update-in-from-clause/
Title:
MySQL error 1093 You can't specify target table
Description:
SQL: Before google DELETE FROM category WHERE id IN ( SELECT c.id as id FROM category c LEFT JOIN category_translation t ON c.id = t.id ...
...
Rating:
4