I have a calculated column and it doesn't give me the same result as the manual calculation using the other columns.
SELECT VG.avg_tax,
VP2.prop * (S.points / 100) / (NULLIF(CAST(VG.avg_tax AS DECIMAL(7 , 2)) , 0)) AS net_points,
VP2.prop ,
S.points,
(NULLIF(CAST(VG.avg_tax AS DECIMAL(7 , 2)) , 0)) AS divisio ,
VP2.new_tax
This is the code first part of the code, where I believe the error to be.
The results are:
+---------+------------+------+--------+----------+----------+
| avg_tax | net_points | prop | points | divisio | new_tax |
+---------+------------+------+--------+----------+----------+
| 1.23 | 43.902439 | 1 | 5442 | 1.23 | 23 |
+---------+------------+------+--------+----------+----------+
As you can see, by calculating by hand, the result at net_points should be: 5442/100 * 1 / 1.23 = 44.2439.
Why is this happening?