mysql5.6 的st_distance 实现按照距离远近排序。

2019-09-02 15:58:32 浏览数 (1)

当前所处在的位置(113.858202 , 22.583819 ),需要查询我附近1000米内的小区,并安装由近到远的顺序排列 

SELECT  s.id,s.name,s.lng,s.lat,

round ((st_distance (point (lng, lat),point(113.858202,22.583819) ) / 0.0111)*1000) AS distance  FROM  wlsq_base.lt s

HAVING distance<10

ORDER BY distance

(adsbygoogle = window.adsbygoogle || []).push({});

0 人点赞