List:General Discussion« Previous MessageNext Message »
From:boll Date:December 21 2006 7:56am
Subject:select from two tables when they correspond, otherwise one table
View as plain text  
This query will display from the 'products' and 'qty_price' tables when 
the 'products.sku' and 'qty_price.qsku' fields match:

SELECT products.sku, products.title, products.price,
 qty_price.qty, qty_price.qprice
FROM products, qty_price WHERE products.sku = qty_price.qsku
AND products.vendor_id=15 AND prod_test.category='widgets';

I would like to change it so that it will display the fields from 
'products'
even if there is no corresponding row in the 'qty_price' table.

Thanks in advance for your suggestions.
J.
Thread
select from two tables when they correspond, otherwise one tableboll21 Dec
  • Re: select from two tables when they correspond, otherwise one tableJocelyn Fournier21 Dec
    • Re: select from two tables when they correspond, otherwise one tableboll22 Dec
  • RE: select from two tables when they correspond, otherwise one tableRuan21 Dec