sql server - SQL Division returning odd value -
so have 2 sum values, return. divide 1 of them other, goal spit out basic value. value returned on place.
i assume screwed "cast" not sure here.
it impossible me share entirety of sql generates this. focus on end results here start outer apply:
this me calling outer apply values display, , attempt @ dividing them:
,verifyblock.numa [numerator] ,verifyblock.denominator ,(isnull(((verifyblock.numa) / nullif(verifyblock.denominator,0)),0)) [division]
this outer apply generates above:
outer apply (select case when cast(tmpdc2.[14]as decimal(10,2)) <= 0 , (case when t4mathblock.[value] >0 t4mathblock.[value] else '0.00' end)<= 0 '0.00' else (case when cast(tmpdc2.[14]as decimal(10,2)) < (case when t4mathblock.[value] >0 t4mathblock.[value] else '0.00' end) cast(tmpdc2.[14]as decimal(10,2)) else (case when t4mathblock.[value] >0 t4mathblock.[value] else '0.00' end) end) end [amount] ##tempdisclosure tmpdc2 tmpdc1.[student number] = tmpdc2.[student number] )[af] tmpdc1.[student number] = tmpdc.[student number] )[verifyblock]
sorry if formatting wonky.
i know values generated by: verifyblock.numa , verifyblock.denominator solid. values return 32747682.64 , 78740189.20 (respectively)
the division though returns: 947860.602435 when should return: 0.4158954019886963
so heck did go wrong here?
Comments
Post a Comment