On Mon, 27 Aug 2007 14:05:57 +0000, Ellen V. Coen wrote
> You could do it by left joining the product table to each of the 
> child tables, then deleting the product records where all child IDs 
> are NULL. To err on the side of safety do it in 2 steps the first time.
> 
> The 1st query would look something like
> 
> SELECT p.productID, c.productID, o.productID, f.productID
> FROM products p
> LEFT JOIN categories c ON p.productID = c.productID
> LEFT JOIN orders o ON p.productID = o.productID
> LEFT JOIN favorites f ON p.productID = f.productID
> ORDER BY c.productID, o.productID, f.productID
> 
> Ellen Coen
> [EMAIL PROTECTED]

Thanks. This looks easy enough.
_______________________________________________
New York PHP Community MySQL SIG
http://lists.nyphp.org/mailman/listinfo/mysql

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to