Round to .5 or 1.0 in SQL

前端 未结 2 760
半阙折子戏
半阙折子戏 2020-12-11 00:49

I\'m looking to round values like

2.3913 -> 2.5

4.6667 -> 4.5

2.11 -> 2

How can I manage this in SQL?

2条回答
  •  情话喂你
    2020-12-11 01:16

    round(round(column/5,1)*5,1) closest 0.5
    round(round(column/5,2)*5,2) closest 0.05

提交回复
热议问题