SELECT *,
ROUND(
6378.138 * 2 * ASIN(
SQRT(
POW(
SIN(
(
lat * PI() / 180) * COS(xx * PI() / 180) * POW(
SIN(
(
$long * PI() / 180 - yy * PI() / 180
) / 2
),
2
)
)
) * 1000
) AS distance
FROM
tp_circle a LEFT JOIN tp_circle_identity b ON a.id = b.circle_id WHERE a.state=1
其中distance是距离
根据经纬度在SQL语句中计算距离并排序
猜你喜欢
转载自blog.csdn.net/qq_42194566/article/details/87967792
今日推荐
周排行