Divide in SQL Help

  • SELECT

    5/2 as ans

    The above returns 2. The right answer should be 2.5. I would like for SQL to output 3. Not sure if this is possible. Does anyone know?

  • You have to convert one of the columns... Try this.

    select ceiling(5/2.0)

    You may need to use round depending on your requirements. For example, ceiling will always round up.

    select Ceiling(2.1), ROUND(2.1,0)

  • Thanks that works great!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply