List:General Discussion« Previous MessageNext Message »
From:Grant Giddens Date:February 11 2006 8:07pm
Subject:How to select data if not in both tables?
View as plain text  
Hi,

  I have 2 tables like:

product_table:
prod_id
item_name
price
data
data
etc

sale_table:
prod_id
sale_price

If I want to select all the products that are in the product_table, but not in the
sale_table, how to make the query?  The product_table has all the products, but the sale
table is a subset of the product_table.

I tried:

SELECT item_name FROM product_table, sale_table WHERE product_table.prod_id !=
sale_table.prod_id but I'm not getting any results from that.

Sorry this code isn't exact, I'm not att my development PC at the moment.

Thanks,
Grant

		
---------------------------------
Brings words and photos together (easily) with
 PhotoMail  - it's free and works with Yahoo! Mail.
Thread
How to select data if not in both tables?Grant Giddens11 Feb
  • Re: How to select data if not in both tables?Peter Brawley11 Feb
    • Re: How to select data if not in both tables?Bob Gailer12 Feb
      • Re: How to select data if not in both tables?Michael Stassen12 Feb
        • Re: How to select data if not in both tables?Bob Gailer13 Feb
          • Re: How to select data if not in both tables?Peter Brawley13 Feb
      • Re: How to select data if not in both tables?Peter Brawley12 Feb
    • Re: How to select data if not in both tables?Grant Giddens12 Feb