n8w Posted July 27, 2009 Share Posted July 27, 2009 I would like to delete records from multiple tables... I have this tutorial http://www.electrictoolbox.com/article/mysql/cross-table-delete/ .. but still can't figure out the correct syntax for my scenario I want to delete all records with user_id=154 from tables users, illustrators, comments *note: each table has a user_id column how should I write that? DELETE users.*, illustrators.*, comments.* FROM users u, illustrators i, comments c WHERE ???? Quote Link to comment https://forums.phpfreaks.com/topic/167641-solved-deleting-records-from-multiple-tables/ Share on other sites More sharing options...
gassaz Posted July 27, 2009 Share Posted July 27, 2009 Something like this: DELETE users.*, illustrators.*, comments.* FROM users u INNER JOIN illustrators i ON u.user_id = i.user_id INNER JOIN comments c ON u.user_id = c.user_id WHERE u.user_id = ??? Quote Link to comment https://forums.phpfreaks.com/topic/167641-solved-deleting-records-from-multiple-tables/#findComment-884287 Share on other sites More sharing options...
n8w Posted July 28, 2009 Author Share Posted July 28, 2009 thanks soooooooooo much .. this rules! Quote Link to comment https://forums.phpfreaks.com/topic/167641-solved-deleting-records-from-multiple-tables/#findComment-884393 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.