Microsoft
Software
Hardware
Network
Question : MS Access SQL Divide by Zero workaround needed
I am writing some SQL (using Access 2007) that sums a column and then uses this value to calculate a percentage of another summed column. However, if there is no data for the denominator summed column, I get the #error result (divide by zero). How can I just replace this quotient with a zero instead of the #error value?
If Sum(Sales.[Total Sales]) below is 0, then I get the #error value for PayrollPercent, and the form that PayrollPercent value is displayed in does not work (not sure why it does not work and simply does not display #error, but that is a separate question)
1:
SELECT Sum(Sales.Payroll)/Sum(Sales.[Total Sales]) AS PayrollPercent FROM Sales
Answer : MS Access SQL Divide by Zero workaround needed
SELECT IIF(Sum(Sales.[Total Sales])=0,0, Sum(Sales.Payroll)/Sum(Sal
es.[Total Sales]) ) AS PayrollPercent FROM Sales
mx
Random Solutions
Exchange 2007 OWA causes 2 audit failures on failed login attempt
Can't obtain cell values from Selected Row of GridView programmatically
Thoughts and comments on a backup solution
PHP array, problems with multiple checkboxes
perl, select rows of data into an array
Can someone please advise the best way to migrate a drupal CMS website to another server
Cisco VPN Client 5.0.07.0290 on Windows 7 64 bit
setting SMTP server - please see attached file - it is not working
Script needed to close program and stop/start service
Shared Folder Disappeared but still available