Created
March 5, 2012 09:34
-
-
Save 65/1977638 to your computer and use it in GitHub Desktop.
finding distance using SQL server between geocoded 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
SELECT postcode, (3959*acos((sin(#latitude#/57.3) * sin(latitude/57.3))+ (cos(#latitude#/57.3) * cos(latitude/57.3) * cos((#longitude# - longitude)/57.3))))*8/5 AS exactDistance | |
FROM postcode | |
WHERE 1=1 | |
ORDER BY (3959*acos((sin(#latitude#/57.3) * sin(latitude/57.3))+ (cos(#latitude#/57.3) * cos(latitude/57.3) * cos((#longitude# - longitude)/57.3))))*8/5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment