MySQL subquery to delete rows -
To delete some specific rows in my application, I'm having trouble executing a subquery. Here is my wrong SQL:
Remove from player_news_items where id in (select player id_imes id, where player_id is not (choose id from player);
What is the correct way to write this query?
In MySQL, you can enter a update
or delete join
. However, I think you want it:
remove player_news_items from pni, where player_id is not (select id from player);
As a note, I recommend it to be written with :
player_news_items pni Does not exist (choose from players 1 where p.player_id = pni.player_id);
Comments
Post a Comment