DELETE statement help
I have a guest id that exists in 3 different tables. I want to delete a guest in one step. How do I use the DELETE statement to delete all data associated with that guest id in all 3 tables with out having to do it 3 separate times ?
Here's what I have:
What other way can I accomplish this ?
The only way you could do that in one step would be:
(a) Be sure you are using INNODB tables, not MyISAM.
(b) Be sure you have specified correct PRIMARY KEY on the guests table.
(c) Be sure you have specified correct FOREIGN KEY contrasints on the other two tables.
(d) Be sure that, in the FOREIGN KEY contraints, you specify ON DELETE CASCADE.
Otherwise, you must delete from each table individually.
|All times are GMT +1. The time now is 10:37 AM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.