This is a discussion on Multi-table deletes within the MySQL General forum forums, part of the MySQL category; --> My SQL: delete c, gt, g, sp from Companies as c, GroupTypes as gt, Groups as g, ServicePersons as ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| My SQL: delete c, gt, g, sp from Companies as c, GroupTypes as gt, Groups as g, ServicePersons as sp where gt.companyuid = c.uid and g.companyuid = c.uid and sp.companyuid = c.uid and c.id = '01' This works fine as long as there are records in all tables, but if one of the tables doesn't have any records then the whole delete won't delete any records. I'm trying to clean up all records related to a specific company. Would it be better to do something like this with triggers? Thanks, David Ruggles CCNA MCSE (NT) CNA A+ Network Engineer Safe Data, Inc. (910) 285-7200 david@safedatausa.com |