Created
September 12, 2013 22:15
-
-
Save brooly/6544575 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 D.ID_DATO, (6371000 * acos(cos(radians(?)) * cos(radians(X(COORDENADAS))) * cos(radians(Y(COORDENADAS))-radians(?)) + sin(radians(?)) * sin(radians(X(COORDENADAS))))) AS DISTANCIA FROM DATOS D, CALLES_PORTALES CP WHERE D.ID_MUNICIPIO=? AND D.ID_TIPOLOGIA IN (7,8) AND ID_DATO NOT IN(?,?) AND D.ID_CALLE=CP.ID_CALLE AND D.ID_MUNICIPIO=CP.ID_MUNICIPIO AND D.NUM_ORDEN=CP.NUM HAVING DISTANCIA>=0 AND DISTANCIA<=300 ORDER BY DISTANCIA |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment