Re: select from two tables when they correspond, otherwise one table

2006-12-21 Thread boll
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

RE: select from two tables when they correspond, otherwise one table

2006-12-21 Thread Ruan
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

Re: select from two tables when they correspond, otherwise one table

2006-12-21 Thread Jocelyn Fournier
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.

select from two tables when they correspond, otherwise one table

2006-12-21 Thread boll
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