I have two tables, user and ban. User table has two columns id
and type
. Ban table also has two columns userID
and bannedUserID
. I want to delete records in ban
table where bannedUserID
has type
of 'Admin'.
I've come up with such query but I am not sure if it is correct or not.
DELETE FROM ban WHERE ban.bannedUserID IN (SELECT id FROM user WHERE type = 'Admin')
Is it correct? Do I have to add/remove anything?