How to find the nearest integer to a specified integer from a table of integers?

Posted by corrilaz on Stack Overflow See other posts from Stack Overflow or by corrilaz
Published on 2010-05-08T07:47:09Z Indexed on 2010/05/08 8:18 UTC
Read the original article Hit count: 182

Filed under:

How to find the nearest integer upon the provided one?

Say, I have the following integers in the mysql database: 405, 600, 304. The question is how to I select 600 upon providing 550 or select 304 upon providing 300 (ie, so as to find the nearest integer)?

i am talking about INTEGERS, not floats.

© Stack Overflow or respective owner

Related posts about mysql