04-03-2008, 03:16 AM
|
#1 (permalink)
|
|
is cute and cuddly
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
|
MySQL syntax for table join on delete
I'm having trouble with the syntax for this statement. When I delete a row from my contact table, I need to also delete any corresponding rows from my contact_additional table. Instead of doing two queries I was trying to do a join based on the syntax I'm reading in the manual, but it's not working;
DELETE FROM contact, contact_additional WHERE contact.ticket=`MM1234.1234` AND contact_additional.ticket=`MM1234.1234`
I keep getting errors! I tried a bunch of variations but I can't figure it out yet.
Also, I'm wondering if I should bother trying to do a join here, because if there's no data in the contact_additional table that matches, I'm guessing it won't delete either row?
-m
|
|
|
|