On Wed, 29 Dec 2004 19:57:04 -0000
"mail.pmpa" <[EMAIL PROTECTED]> wrote:

> What I am trying to do is: 
> Select products and join brand, but only products that are not new
products.
> What I have is:
> 
> ( SELECT products.id, products.model
> FROM products, brands
> WHERE products.brand = brands.id )
> UNION ALL
> ( SELECT products.id, products.model
> FROM products, new_products
> WHERE products.id != new_products.product_id )

SELECT t01.id, t01.model
FROM products t01 JOIN brands t02
ON t01.brand = t02.id
WHERE NOT EXISTS (
SELECT * FROM new_products t03
WHERE t03.product_id = t01.id)

Alex

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

Reply via email to