title: MySQL aggregate function to find closest value
body: <p>In MySQL, is there any aggregate function (or any other method) to find closest value to specific value? </p>
  
  <p>For example, I'm looking for addresses, where house number is 15. Or, when some streets doesn't have house no 15, closest house number (like 14 or 16) should be returned:</p>
  
  <pre><code>SELECT closest(house_no, 15), street_name
  FROM addresses
  GROUP BY street_name
  </code></pre>
  
  <p>Since there's need to aggregate, I can't see any help from <code>ORDER BY ABS(house_no - 15) LIMIT 1</code> which could be used to get single result.</p>