title: MySQL: Return first three entries from table sorted by distance: giving latitude and logitude as params
body: <p>I tried:</p>
  <pre><code>var latitude = K.params.latitude
  var longitude = K.params.longitude
  
  var sqlString = &quot;SELECT name, latitude, longitude, SQRT( \
      POW(69.1 * (latitude - '&quot;+latitude+&quot;'), 2) + \
      POW(69.1 * ('&quot;+longitude+&quot;' - longitude) * COS(latitude / 57.3), 2)) AS distance \
  FROM 10561_12865_tblEvents HAVING distance &lt; 25 ORDER BY distance&quot;
  
  var results = K.query(sqlString, [])
  </code></pre>
  <p>But this returns only 1 result, sometimes none when it should have.</p>
  <p>Do you have a better solution for me?</p>
  <p>Thank you :)</p>