Instantly share code, notes, and snippets.

Embed
What would you like to do?
This query will return the distance between two points
#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