mysql 根据经纬度查询指定范围内的数据

SELECT *,
(
6371 * acos (
cos ( radians('124.161105') )
* cos( radians(lat) )
* cos( radians(lnt) - radians('39.84591') )
+ sin ( radians('124.161105') )
* sin( radians(lat) )
)
) AS distance
FROM enterprise
HAVING distance < 200 

 

6371地球半径

200KM范围

posted @ 2022-03-24 11:12  wendou  阅读(681)  评论(0编辑  收藏  举报