All In One Script
MENU

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

by 4:32:00 AM
undefined
MySQL Error 1093 - Can't specify target table for update in FROM clause 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:          

Throw an error in a MySQL Trigger

by 3:09:00 AM
undefined
Throw an error in a MySQL Trigger If I have a trigger before the update on a table, how can I throw an error that prevents the update on that table? Solution :  Here is one hack that may work. It isn't clean, but it looks like it might work: Essentially, you just try to update a column that doesn't exist.

Instagram