I have table name with latitude and longitude and so on, now i want to get data with in radius in mysql query, for example saved some data with latitude and longitude and some details about location now i want to get near places around one kilometers any other way to get this ?
            Asked
            
        
        
            Active
            
        
            Viewed 60 times
        
    -1
            
            
        - 
                    Look into using the [Haversine formula](http://stackoverflow.com/questions/574691/mysql-great-circle-distance-haversine-formula). If you plan on doing this query in production, then you might also want to consider using a geospatial partition in your database. – Tim Biegeleisen Oct 01 '16 at 11:39
 
1 Answers
0
            
            
        SELECT * FROM (SELECT * (6367*acos(cos(radians(input_lat))
   *cos(radians(database_latitude_col))*COS(radians(database_longitude_col)-radians(input_long))
   +SIN(radians(input_lat))*SIN(radians(database_latitude_col))))
   AS "distance" FROM table_name) distance where
   distance < your_distance;
        Raj
        
- 65
 - 2