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;
- LAT 表中纬度
- LNT表中经度
- 传入数据114.812951,38.754494