mySQL select zipcodes within x km/miles within range of y

前端 未结 3 729
名媛妹妹
名媛妹妹 2020-12-17 07:11

Note: Although I use a zipcode database with Dutch zipcodes, this question is country independent.

I have a database with every zipcode in the Netherlands +

3条回答
  •  别那么骄傲
    2020-12-17 07:46

    You want to do something like this:

    SELECT zipcode FROM zipcodes WHERE DistanceFormula(lat, long, 4.808855, 52.406332) < $range

    It may be slow if your table of zip codes is large. You may also want to check out the geospatial extensions for MySQL.

提交回复
热议问题