Mysql计算经纬度之间的距离

SELECT 
    store_id,
    lng,lat, 
    ROUND(6378.138*2*ASIN(SQRT(POW(SIN((22.299439*PI()/180-lat*PI()/180)/2),2)+COS(22.299439*PI()/180)*COS(lat*PI()/180)*POW(SIN((114.173881*PI()/180-lng*PI()/180)/2),2)))*1000) AS distance
FROM 
    store_info
ORDER BY 
    distance DESC
LIMIT 100
    原文作者:Prasanta
    原文地址: https://segmentfault.com/a/1190000008377635
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞