Round to .5 or 1.0 in SQL

守給你的承諾、 提交于 2019-11-30 21:45:12

问题


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?

Thanks


回答1:


SELECT ROUND(2.2 * 2, 0) / 2 

gets you to the nearest .5



来源:https://stackoverflow.com/questions/9873990/round-to-5-or-1-0-in-sql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!