mysql 根据经纬度计算距离

SELECT store.id,`storename`,`storelogo`,`storelng`,`storelat`,`storeaddress`,`storetel`,`storephone`,`typename`,`storestatus`, FROM app_store_info store LEFT JOIN app_store_type type ON store.storetype = type.id LIMIT 0,25   

距离计算公式(单位:米)

ROUND(6378.138 * 2 * ASIN(SQRT(POW(SIN(
    (37.8435830000 * PI() / 180 - lat * PI() / 180) / 2
),2) + COS(37.8435830000 * PI() / 180) * COS(lat * PI() / 180) * POW(SIN((
    112.5924370000 * PI() / 180 - lng * PI() / 180) / 2),2))) * 1000
) as juli

猜你喜欢

转载自blog.csdn.net/u011105380/article/details/80526791