Database calculations are wrong

前端 未结 1 700
[愿得一人]
[愿得一人] 2021-01-23 10:31

Here is what I\'m setting:

result = price / (case when tax = 0 then @tax1h / 100 else @tax2 / 100 end + 1)

These are the values:



        
相关标签:
1条回答
  • 2021-01-23 10:40

    Integer division:

    select (6 / 100 + 1)
    

    The result of the above is 1.

    However, the result of:

    select (6 / 100.0 + 1)
    

    Is 1.06.

    0 讨论(0)
提交回复
热议问题