Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

order records between two cordinates sql

SELECT 
id, 
(
   3959 *
   acos(cos(radians(37)) * 
   cos(radians(lat)) * 
   cos(radians(lng) - 
   radians(-122)) + 
   sin(radians(37)) * 
   sin(radians(lat )))
) AS distance 
FROM markers 
HAVING distance < 29 and distance > 28 
ORDER BY distance LIMIT 0, 20;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #order #records #cordinates #sql
ADD COMMENT
Topic
Name
3+8 =