Ok... I always struggle with LEFT JOINS for some reason in SQL.
I have a simple query
SELECT COUNT(*) as OpenedToday, c.Product_Line, c.Product_Code
FROM SFCase as c
LEFT OUTER JOIN (SELECT DISTINCT Product_Code from SFCase) as p ON p.Product_Code = c.Product_Code
GROUP BY c.Product_Line, c.Product_Code
What I'm expecting is a list of all Product_Code, with a count of how many cases were OpenedToday (including zero values). Instead, I only get a list of those product codes that have cases opened today (only positive values).
What am I doing wrong with this join?