on 05-04-2017 9:16 PM
We are having a sum aggregation in the SQL query, which gives the summation of a column (decimal). This column (col1) has 3 values - 0, 1, 0.5. When I am doing a sum on col1, it is not resulting the correct output.
Occurrence of the above values as follows -
0 - 2 (count), 0E-16 (SUM) <-- Which I believe is 0
1- 16941 (count), 16794 (SUM) <-- This should be 16941
0.5 - 324 (count), 162 (sum)
Sum(col1) - 17120
Expected - 17103.
I have taken the individual sum and count for all above occurrences (using where clause)
col1 is a calculated column, which converts the data type length of another column (col) from decimal (38,16) to decimal (28,16). Interestingly when I am doing Sum(col), I am getting 17103.
Calculated column -
Hi Deba,
Try setting to 1 (instead of 16) the scale of the calculated column "COL1" and let us know the results.
Best regards,
Francisco.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.