1

so I have two tabels where one has a list of all postcodes with long and lat and the other has store data with long and lat.

What I need to know is how do I find all the stores that match the long and lat from a postcode within 30km

RussellHarrower
  • 6,470
  • 21
  • 102
  • 204

2 Answers2

0

Use the Haversine formula (MySQL implementation) to calculate the distance between them. Return rows which have a distance of less or equal to 30.

Community
  • 1
  • 1
alex
  • 479,566
  • 201
  • 878
  • 984
0

Review this http://jan.ucc.nau.edu/~cvm/latlon_formula.html for formula, and put the formula on select statement and order by the distance

Alpha01
  • 838
  • 6
  • 13