I think this will work

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

Ruan

-----Original Message-----
From: boll [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 21, 2006 9:56 AM
To: mysql@lists.mysql.com
Subject: select from two tables when they correspond, otherwise one table

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.

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


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

Reply via email to