开发者

How To rounded to the lowest multiple of 5 in SQL SERVER 2008?

how to round a number to the开发者_JS百科 minimum number that is a multiple of 5

Examples:

  • if we have 49 it should be rounded to 45 not 50
  • if we have 54 it should be rounded to 50.

This is wrong:

SELECT ROUND(49, -1)


Integer arithmetic will do it

SELECT FLOOR(49/5) * 5,  FLOOR(54/5) * 5
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜