Database calculations are wrong

前端 未结 1 701
[愿得一人]
[愿得一人] 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)
提交回复
热议问题