southernweyr
Programmer
I have tried to calculate the sum of two fields with little success. I have been able to combine the numbers in two fields by using
or total: Nz([hours],0)+Nz([total hours],0)
They both just put all of the numbers from the two fields into the field "total." Like this
hours | total hours | total
0 182 182
2 0 2
3 0 3
7 0 7
Trying total:[hours]+[total hours]
ends up having all of the numbers from [hours] but nothing from [total hours]
What I want is 182+2+3+7=194 or 182+12=194
hours | total hours | total
182 194
2
3
7
Code:
SELECT [hours data].hours AS hours, [hours data].[total hours], Sum(Nz([hours],0)+Nz([total hours],0)) AS total
FROM [hours data]
GROUP BY [hours data].hours, [hours data].[total hours];
They both just put all of the numbers from the two fields into the field "total." Like this
hours | total hours | total
0 182 182
2 0 2
3 0 3
7 0 7
Trying total:[hours]+[total hours]
ends up having all of the numbers from [hours] but nothing from [total hours]
What I want is 182+2+3+7=194 or 182+12=194
hours | total hours | total
182 194
2
3
7