how do I formulate this DELETE query?
Posted on 2012-04-11
I have two tables: products(product_id,date) and sex(product_id,sex).
I want to DELETE from the products table all products having a product_id for which a row exists in the sex table with this product_id and sex=1.
I also wish to DELETE from the sex table all rows containing a product_id contained in one of the rows I am deleting from the products table.
(This may delete more rows from the sex table than the products table, because a given product_id might appear more than once in the sex table (once with sex=1, once with sex=0).)