Skip to content

Instantly share code, notes, and snippets.

@bkempner
Created June 21, 2011 04:35
Show Gist options
  • Save bkempner/1037252 to your computer and use it in GitHub Desktop.
Save bkempner/1037252 to your computer and use it in GitHub Desktop.
SELECT lat, lon, SQRT( POW( 69.1 * ( lat - 33.673989 ) , 2 ) + POW( 69.1 * ( 111.858430 - lon ) * COS( lat / 57.3 ) , 2 ) ) AS distance FROM cities where distance < 25 ORDER BY distance;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment