LMSouq
database Open

MySQL Error 1093 - Can't specify target table for update in FROM clause

SE
Sergio del Amo
1 month ago
3 views
Problem Description
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 executing: 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 How can I overcome this?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base