How to get a column with nulls to report a 0 (zero) total.

SteveOPI

New Member
Joined
Dec 16, 2015
Messages
6
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.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,225,767
Messages
6,186,907
Members
453,386
Latest member
testmaster

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top