Created
August 30, 2016 15:10
-
-
Save antoniodipinto/db9b683b267d64549a9e612e74e9040b to your computer and use it in GitHub Desktop.
This query will return the distance between two points
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This query will return the distance between two points | |
SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) | |
AS distance | |
FROM markers | |
HAVING distance < 25 | |
ORDER BY distance LIMIT 0 , 20; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment