[eluser]danmontgomery[/eluser]
Ah, I think I get it now.
You can get the location ID first, then add it to the join statement instead of using WHERE:
Code:
SELECT COUNT(inventory.serial_no) AS qty, products.id AS product_id, products.name AS product_name
FROM products
LEFT JOIN inventory ON ( inventory.product_id = products.id AND location_id = 2 )
GROUP BY products.id
Quote:qty product_id product_name
1 1 Product 1
0 2 Product 2
0 3 Product 3
0 4 Product 4
0 5 Product 5
0 6 Product 6