Darryl,

At first blush, I would try something like:

 DELETE faqcat
 FROM faqcat LEFT JOIN article 
 ON faqcat.cat = article.cat 
 WHERE article.cat Is Null;

I vaguley remember MySQL implementing syntax permitting users to remove data
from one or more tables. I think this might be your ticket.

Regards,
Adam

-----Original Message-----
From: Darryl Hoar [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 07, 2003 11:11 AM
To: [EMAIL PROTECTED]
Subject: Query help


I have a two tables.
One has catagories, the other has articles.
I need a query that deletes catagories only
if not articles have that catagory.

Table faqcat(cat int not null auto_increment, name varchar(20))

Table article(aid in not null auto_increment, cat int, .....)

Want to :
delete from faqcat where cat=1 (if no records in table article
have field with cat set to 1.

how do I accomplish this with a single query ?

thanks,
-D

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to