By using the
FLOOR function in SQL we are able to round number down to next lowest integer, for example,
SELECT FLOOR(1.1) -- RETURNS 1
In the above example by using the
FLOOR function we round down the value 1.1 to the next lowest integer which is 1.
Some further examples of the
SELECT FLOOR(1.10) -- RETURNS 1 SELECT FLOOR(1.00001) -- RETURNS 1 SELECT FLOOR(1.99) -- RETURNS 1 SELECT FLOOR(0.01) -- RETURNS 0
Note, there is a opposite function called
CEILING which rounds up to the next highest integer.
For more information about the
FLOOR function check the MSDN page http://msdn.microsoft.com/en-us/library/ms178531.aspx