Reputation: 639
I've got 2 tables:
id | name | mail | pass | salt
id | uid | title | text | timestamp
Now I want to delete all rows of entries
with an uid
, which doesn't exist in user
-table
(deleted users)
I think this might work like this:
DELETE entries FROM user, entries WHERE [What comes here? I don't know :(]
Upvotes: 3
Views: 525
Reputation: 14479
DELETE FROM entries WHERE uid NOT IN (SELECT DISTINCT id FROM user);
Upvotes: 7