|Think about Loose Coupling|
(OT) MySQL: delete from multiple tablesby Anonymous Monk
|on Mar 14, 2005 at 15:21 UTC||Need Help??|
Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
I am having some trouble deleting values from multiple table in mysql. the code I have written works fine, but it seems it keeps failing on the actual statement issued to mysql.
I have several tables, each with a field called data_id. The rest of the fields can vary from table to table. What I would like to do is simply delete all rows from the specified tables where data_id='111'. (data_id isn't unique, so many rows can have the data_id 111 in each table.
This is my sql statement...so whats wrong with this!?
DELETE FROM table1, table2, table3 WHERE data_id="111";
thanks in advance, Steve
20050315 Edit by castaway: Changed title from 'MySQL: delete from multiple tables'