Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我创建了一个 mySql 查询,它返回按用户当前位置的接近度排序的所有结果。这是:
SELECT ID FROM myTable ORDER BY (POW((longitude-40.23120),2) + POW((latitude-23.12302),2)) LIMIT 0,10
我声明,数值分别是当前用户的经度和纬度。它可以正常工作,但我需要向查询添加一个约束:我希望查询返回半径为 5 公里的结果,并且不返回该半径之外的结果。