Results 1 to 3 of 3
Thread: Is this delete query possible?
Jan 17, 2005, 13:09 #1
- Join Date
- Sep 2002
- Atlanta, GA
- 0 Post(s)
- 0 Thread(s)
Is this delete query possible?
I thought this would be a pretty simple delete query, but it's turning out to be quite a problem.
I have two tables, "cust_email" and "cust_lookup" and the two fields I'm working with are "order_id" and "number". I'm trying to delete every record in "cust_lookup" where the "order_id" in the "cust_lookup" table = the "order_id" in the cust_email table and where "number" = 'PROCESSING'. Your help is greatly appreciated.
What I've tried so far is:
mysql_query("DELETE FROM cust_lookup WHERE number = 'PROCESSING' AND cust_lookup.order_id=cust_email.order_id") or die(mysql_error());
mysql_query("DELETE FROM cust_lookup WHERE number = 'PROCESSING' AND cust_lookup.order_id IN (SELECT order_id FROM cust_email)") or die(mysql_error());
Someone else tried to help here: http://www.sitepoint.com/forums/show...postid=1619356
I always get an error similar to: You have an error in your SQL syntax near 'SELECT order_id FROM cust_email' at line 1
Your help is appreciated.Jimmy Day
Senior Systems Analyst
Piedmont Healthcare Corporation