I have a MySQL database and one of the tables lists the line items of everything my customers have ordered. I am using Excel 2007. I have a query that totals what else customer has order in a specific period of time. It lists the customer number, customer name, and the total that they have ordered. However, if they have not ordered anything, they do no appear in the list. I would like the list (Sum(invoicehistoryline_0.LineExtension) AS 'SALES') to show those customers with a 0 (zero) total. I am posting the SQL code below.
SELECT invoicehistoryline_0.CustomerNumber AS 'CUST #', customermaster_0.CustomerName AS 'CUST NAME', Sum(invoicehistoryline_0.LineExtension) AS 'SALES'
FROM VOL01.customermaster customermaster_0, VOL01.invoicehistoryline invoicehistoryline_0
WHERE customermaster_0.CustomerNumber = invoicehistoryline_0.CustomerNumber AND ((invoicehistoryline_0.InvoicePostDate>={d '2012-01-01'} And invoicehistoryline_0.InvoicePostDate<={d '2012-12-31'}) AND (invoicehistoryline_0.GLCode=102) AND (customermaster_0.Territory=8))
GROUP BY invoicehistoryline_0.CustomerNumber
ORDER BY customermaster_0.CustomerName
Any help would be greatly appreciated. Thanks in advance.
SELECT invoicehistoryline_0.CustomerNumber AS 'CUST #', customermaster_0.CustomerName AS 'CUST NAME', Sum(invoicehistoryline_0.LineExtension) AS 'SALES'
FROM VOL01.customermaster customermaster_0, VOL01.invoicehistoryline invoicehistoryline_0
WHERE customermaster_0.CustomerNumber = invoicehistoryline_0.CustomerNumber AND ((invoicehistoryline_0.InvoicePostDate>={d '2012-01-01'} And invoicehistoryline_0.InvoicePostDate<={d '2012-12-31'}) AND (invoicehistoryline_0.GLCode=102) AND (customermaster_0.Territory=8))
GROUP BY invoicehistoryline_0.CustomerNumber
ORDER BY customermaster_0.CustomerName
Any help would be greatly appreciated. Thanks in advance.