Skip to content

Instantly share code, notes, and snippets.

@cobergmd
Created May 15, 2018 13:41
Show Gist options
  • Save cobergmd/30dd493eadf7e19b52d01dc64ec74cbf to your computer and use it in GitHub Desktop.
Save cobergmd/30dd493eadf7e19b52d01dc64ec74cbf to your computer and use it in GitHub Desktop.
SQL Euclidian Distance
-- Euclidian Distance
-- a = min lat
-- b = max lat
-- c = min long
-- d = max long
-- sqrt ( square(B - A) + square(D - C) )
select
format (sqrt(square(max(lat_n) - min(lat_n)) + square(max(long_w) - min(long_w))),'F4')
from latlongs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment