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,339
  • 20
  • 90
  • 182

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
  • 460,746
  • 196
  • 858
  • 974
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
  • 828
  • 6
  • 13