sql传入经纬度查询附近数据

2021-11-03  本文已影响0人  阿拉里咯里
SELECT
    ROUND(
        6378.138 * 2 * ASIN(
            SQRT(
                POW(
                    SIN((
                            38.754494 * PI()/ 180-LAT * PI()/ 180 
                            )/ 2 
                    ),
                    2 
                    )+ COS( 38.754494 * PI()/ 180 )* COS( LAT * PI()/ 180 )* POW(
                    SIN((
                            114.812951 * PI()/ 180- LNT * PI()/ 180 
                            )/ 2 
                    ),
                    2 
                )))* 1000 
    ) AS distance,
    a.* 
FROM
    shop_info AS a 
HAVING
    distance <= 10000 
ORDER BY
    distance ASC;
   

上一篇下一篇

猜你喜欢

热点阅读