Difference between sum(round(field)) and round(sum(field)) in terms of execution, speed, output
Difference between sum(round(field)) and round(sum(field)) in SQL (In terms of execution, speed, output)?
July 22nd, 2011 12:39pm
In terms of Output it will differ a lot if your system needs high precision then you should use round(sum(field))
consider this
2.52
1.56
1.40
2.96
round(sum(fields)) will give 8 i.e. 8.44
and
sum(round(field)) will give 9 i.e. 3+2+1+3
--------------------------------------------------------
Surender Singh Bhadauria
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2011 1:27pm
There will definately be a difference in terms of execution, speed and output.
If you had two rows in your dataset with values 1.6 and 1.7
=sum(fields!myfield.value) = 3.3
=round(sum(fields!myfield.value)) = 3
=sum(round(fields!myfield.value)) = 4 'first rounds both 1.6 and 1.7 to 2, then sums it.
whatever happens inside the aggregate function is done to each and every record in the group/dataset, so you are calling the round function for every record if you use sum(round(field))
July 22nd, 2011 1:55pm


