Created
February 6, 2017 19:17
-
-
Save daniel7byte/075843c3effc70405e13796a1a6f38fc to your computer and use it in GitHub Desktop.
Author: victor-basurto
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
/* Mi Ubicacion Actual */ | |
/* Lat: 3.4227857999999998, Lng: -76.55079080000002 */ | |
SELECT id, latitud, longitud, SQRT( | |
POW(69.1 * (latitud - '3.4227857999999998'), 2) + | |
POW(69.1 * ('-76.55079080000002' - longitud) * COS(latitud / 57.3), 2)) AS distance | |
FROM cali_sucursales HAVING distance < 0.5; | |
/* Donde 0.5 es el rango en millas */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment