Thanks, Jocelyn. That's what I was looking for.
Jocelyn Fournier wrote:
Hi,
SELECT products.sku, products.title, products.price,
qty_price.qty, qty_price.qprice
FROM products LEFT JOIN qty_price ON (products.sku = qty_price.qsku)
WHERE products.vendor_id=15 AND products.category='widgets';
s
ecember 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:
S
Hi,
SELECT products.sku, products.title, products.price,
qty_price.qty, qty_price.qprice
FROM products LEFT JOIN qty_price ON (products.sku = qty_price.qsku)
WHERE products.vendor_id=15 AND products.category='widgets';
should do what you want.
Regards,
Jocelyn Fournier
www.mesdiscussions.
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=1