I have a table hotspots
id name date
1 foo 2011-06-15 15:10:34
2 bar 2011-07-02 16:45:18
And a table locations
hotspotid zipcode latitude longitude
1 90001 xxxxx xxxxx
2 45802 xxxxx xxxxx
How can i list the hotspots nearby to a specific latitude and longitude with miles limit using an SQL query?
P.S. i’d like a pure SQL solution but php is ok if it’s needed.
Thanks
First you need a geographic location for each hotspot ideally using latitude and longitude. You can use the Google Geocoding API to go through each record and store lat/long.
Then you can match nearby hotspots with this SQL query and order by distance.
Hope that helps.