Reputation: 95
In SQL server 2008, I would like to get the nearest "0.25", but inferior than the number I put. Preferably with existing functions in 2008.
I need something like this:
0.26 => 0.25
0.48 => 0.25
0.74 => 0.5
0.98 =>0.75
25.17 = 25.00
I was using CEILING('number' /0.25) *0.25
but give the nearest superior, and I need the inferior. Any guidance would be helpful! Thanks!
Upvotes: 1
Views: 1879
Reputation: 1269633
Use floor()
, but you also need to get rid of the single quotes around number
:
FLOOR(number / 0.25) * 0.25
Upvotes: 2