Jump to content

[SOLVED] delete from multiple tables


atomicrabbit

Recommended Posts

ok i'm trying to delete multiple entries from multiple tables. In this specific case, I want to delete all specified entries from mw_users and mw_companies (which most likely will exist), but delete the entries from mw_orders ONLY if they exist.

 

Using OR instead of AND deletes ALL values from ALL three tables.

 

DELETE mw_users, mw_companies, mw_orders FROM mw_users, mw_companies, mw_orders WHERE mw_users.company_id IN ('27','28') AND mw_companies.id IN ('27','28') AND mw_orders.company_id IN ('27','28')

Link to comment
https://forums.phpfreaks.com/topic/124208-solved-delete-from-multiple-tables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.