Re: how to join two tables and include all records from one

2004-07-16 Thread Michael Stassen
LEFT JOIN is the way to go, but you need to make the invoice ID part of the JOIN condition rather than putting it in the WHERE clause. SELECT i.IDItems, i.Name, IFNULL(inv.Qty, 0) AS Qty FROM Items i LEFT JOIN Invoice inv ON i.IDItems = inv.IDItems AND

how to join two tables and include all records from one

2004-07-15 Thread Cedric
Hi, I'm quite new to mysql and I need to join two tables: Items IDItems Name 1 Orange 2 Apple 3 Bread 4 Milk ... Invoice IDInvoice IDItems Qty 1001 1 10 1001 3 2 1002 2 5 ... I need to get all items and for items included in invoice