I've got 2 tables say users and articles, I need to delete a user and all instances of that user from articles as well but I need to do it in a single statement. So I can't say:
DELETE FROM users WHERE id = 1
DELETE FROM articles WHERE user_id = 1
Is there a way I can say something like:
SELECT u.name, u.id, a.user_id
FROM users u, articles a
WHERE u.id = a.user_id
DELETE FROM thistable
WHERE id = 1
Any help would be greatly appreciated