MySQL Forums
Forum List  »  Newbie

Re: how can I query 2 tables and list results of records that re only found in one please?
Posted by: Felix Geerinckx
Date: August 20, 2005 02:09AM

kenny wrote:

> I have two tables one called 'products' and one called 'products_closing'.
> Both tables have a primary key of product_sku which is a unique product number for each
> product.
>
> What I need to do is run a query that returns all of the products in the 'products' table which are
> NOT listed in both tables - so I need a query that returns products which are in the 'products' table
> but NOT in the 'products_closing' table (ie: get a list of all products which have no risk of being
> unavailable or discontinued for that day)

SELECT
p.product_sku
FROM products p
LEFT JOIN products_closing pc ON pc.product_sku = p.products_sku
WHERE
pc.products_sku IS NULL

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Written By
Posted
Re: how can I query 2 tables and list results of records that re only found in one please?
August 20, 2005 02:09AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.