mysql 经纬度求距离

SELECT id,lng,lat,
ROUND(6378.138*2*ASIN(SQRT(POW(SIN((lat1*PI()/180-lat*PI()/180)/2),2)+COS(lat1*PI()/180)*COS(lat*PI()/180)*POW(SIN((lng1*PI()/180-lng*PI()/180)/2),2)))*1000)
AS
 juli
FROM address having juli > 500
ORDER BY juli Asc
LIMIT 100



lng1为自定义的经度

lat1为自定义的纬度


posted @ 2019-04-23 17:41  酷酷的城池  阅读(237)  评论(0编辑  收藏  举报