Created
January 10, 2018 23:38
-
-
Save sublimecoder/b06907d6e1940aea7bc9e9ec34800984 to your computer and use it in GitHub Desktop.
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
SELECT | |
zipcode | |
( | |
3959 * acos( | |
cos(radians($LattitudeVar)) * cos(radians(latitude)) * cos( | |
radians(longitude) - radians($longitudeVar) | |
) + sin(radians($LattitudeVar)) * sin(radians(latitude)) | |
) | |
) AS distance | |
FROM | |
zipcodedata | |
HAVING | |
distance <= 5 | |
ORDER BY | |
distance |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment