mysql根据经纬度查询列表,根据距离排序

时间:2019-12-30 11:43:17 阅读:95次
SELECT
    id,
    latitude,
    longitude,
    ROUND(
        6378.138 * 2 * ASIN(
            SQRT(
                POW(
                    SIN(
                        (
                            23.163292 * PI() / 180 - latitude * PI() / 180
                        ) / 2
                    ),
                    2
                ) + COS(23.163292 * PI() / 180) * COS(latitude * PI() / 180) * POW(
                    SIN(
                        (
                            113.3114676 * PI() / 180 - longitude * PI() / 180
                        ) / 2
                    ),
                    2
                )
            )
        ) * 1000
    ) AS distance
FROM
    cw_party
ORDER BY
    distance asc


扫描二维码关注程序员爱笔记,接收更多资讯

上一篇: andrid studio 常用快捷键

下一篇: vue

评论

快速评论