I have a TSQL Query that does something like this:
SELECT SUM(s.Amount) as TotalSales, p.ProductName
FROM SALES s
INNER JOIN Product p ON s.ProductID = p.ID
GROUP BY p.ProductName
The resulting output is
TotalSales Product
-----------------------
123.45 Apples
234.56 Oranges
345.67 Grapes
What I would like to do is get ALL the products in the results, even the ones that have no sales. I tried doing a LEFT JOIN on the product table, but that just confuses things.
So I would like my output to be something like this.
TotalSales Product
-----------------------
123.45 Apples
234.56 Oranges
345.67 Grapes
0.0 Lemons
0.0 Grapefruit
Any idea how to do this?