Re: possible bug left join and null

2005-04-21 Thread James Nobis
Thanks everyone for such quick and thorough responses! Quoting [EMAIL PROTECTED]: James Nobis <[EMAIL PROTECTED]> wrote on 04/21/2005 10:44:07 AM: The problem is something fairly simple but yet MySQL seems to make this complicated. Essentially, find a list of customers who have not bought product

Re: possible bug left join and null

2005-04-21 Thread Brent Baisley
There is nothing wrong with what MySQL is doing. Your query is incorrect for what you are looking for. Step through your query and you'll see your error. SELECT DISTINCT Customer.id, Customer.name FROM Customer LEFT JOIN `Order` ON Customer.id = Order.customer_id You now have a list of the all y

Re: possible bug left join and null

2005-04-21 Thread SGreen
James Nobis <[EMAIL PROTECTED]> wrote on 04/21/2005 10:44:07 AM: > The problem is something fairly simple but yet MySQL seems to make this > complicated. Essentially, find a list of customers who have not > bought product > X ever. (Customers have orders, orders have order line items). All >

Re: possible bug left join and null

2005-04-21 Thread Jigal van Hemert
From: "James Nobis" > SELECT DISTINCT Customer.id, Customer.name > FROM Customer > LEFT JOIN `Order` ON Customer.id = Order.customer_id > INNER JOIN OrderLines ON Order.id = OrderLines.order_id > AND OrderLines.product_id =9 > WHERE Order.customer_id IS NULL I expect customers to have placed at le