I have a table *story_category* in my database with corrupt entries. The next query returns the corrupt entries.
SELECT * FROM story_category WHERE category_id NOT IN (
SELECT DISTINCT category.id FROM category INNER JOIN story_category ON category_id=category.id);
I tried to delete them excuting:
DELETE FROM story_category WHERE category_id NOT IN (
SELECT DISTINCT category.id FROM category INNER JOIN story_category ON category_id=category.id);
but i get the next error:
#1093 - You can't specify target table 'story_category' for update in FROM clause
Does anyone knows how can i overcome this?