EXISTS/NOT EXISTS

2004-06-18 Thread Anton Ivanov
Hi, I'm trying to figure out how to apply these from the manual, but to no avail. Is it possible that my version (4.0.18) does not implement these? I have two tables: products and products_by_product_area. Both have a field product. I try SELECT product from products WHERE NOT EXISTS (SELECT

Re: EXISTS/NOT EXISTS

2004-06-18 Thread Andrew Pattison
18, 2004 10:16 PM Subject: EXISTS/NOT EXISTS Hi, I'm trying to figure out how to apply these from the manual, but to no avail. Is it possible that my version (4.0.18) does not implement these? I have two tables: products and products_by_product_area. Both have a field product. I try SELECT

Re: EXISTS/NOT EXISTS

2004-06-18 Thread Michael Stassen
SELECT product from products WHERE NOT EXISTS (SELECT DISTINCT * from products_by_product_areas WHERE products_by_product_areas.product = products.product); Both of these queries run fine on their own. It looks to me that I'm simply adapting from the manual, but all I get is ERROR 1064: You have

RE: EXISTS/NOT EXISTS

2004-06-18 Thread Anton Ivanov
] Sent: Friday, June 18, 2004 2:38 PM To: Anton Ivanov Cc: [EMAIL PROTECTED] Subject: Re: EXISTS/NOT EXISTS Subqeries require mysql 4.1. The manual offers some suggestions on rewriting subqueries as JOINs http://dev.mysql.com/doc/mysql/en/Rewriting_subqueries.html. In your case, you want