I think I'm just going to stick with two queries, because I need it to delete from the first table regardless of there being additional information in the second, but I want to figure this out just because I can't!
I tried yours serversphere and I got an error 1064 (42000) from MySQL. So I tried this, based off an example in the MySQL documentation at
MySQL :: MySQL 5.0 Reference Manual :: 12.2.1 DELETE Syntax, but...
Code:
DELETE FROM contact, contact_additional USING contact, contact_additional WHERE contact.ticket=contact_additional.ticket AND contact.ticket=`mm1234.1234`;
and get...
Code:
ERROR 1054 (42S22): Unknown column 'mm1234.1234' in 'where clause'
So I'm not sure how to tell it what information to look for in the delete. I don't want it to just delete all columns that match up, that's just bad. The more I read the manual here, it looks like I may have to do a SELECT first...
Code:
CREATE TEMPORARY TABLE tmptable
SELECT t1.* FROM table1 as t1
LEFT JOIN table2 as t2 ON t2.id = t1.id
WHERE t2.id is NULL;
DELETE FROM table1 USING tmptable, table1
WHERE table.id = tmptable.id;
...anyways... Sorry about this being posted in the wrong forum, I've honestly never scrolled that far down before to realize there was one! I'm new (obviously) so I've just been catching up reading the beginner/advanced and general forums. If a mod wants to move it, I'll know where to find it! Thanks for all the help guys.
-m