Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This query return the distance between two cordinates
#This query return the distance between two cordinates
SELECT *,
(((acos(sin((LATITUDE_VALUE*pi()/180)) * sin(('nome_colonna_latitudine'*pi()/180))+cos((LATITUDE_VALUE*pi()/180)) * cos(('nome_colonna_latitudine'*pi()/180)) * cos(((LONGITUDE_VALUE- 'nome_colonna_longitudine'e)*pi()/180))))*180/pi())*60*1.1515*1.609344)
as distance
FROM coordinates_table
ORDER BY distance ASC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.