【发布时间】:2018-02-01 18:56:41
【问题描述】:
我正在尝试计算与给定 Point(lat, long) 的距离,但是当我使用按距离列排序时,我得到 Commands out of sync; you can't run this command now 错误。
这是我的查询:
SELECT id, name, country_code, postal_code, latitude, longitude,
st_distance_sphere(
point(50.77333, 7.185259),
point(latitude, longitude)
) AS distance
FROM place_merged WHERE name LIKE ('ko%') ORDER BY distance
如果我删除ORDER BY 子句,它执行得很好。有什么方法可以计算距离并获得距离我提供的latitude & longitude 一定距离的地方?
【问题讨论】:
-
该错误与使用同一个游标对象执行多个查询有关。显示您的代码。
-
我在 phpmyadmin 中运行这个查询,不涉及任何代码。
-
听起来像一个 phpMyAdmin 错误。
标签: mysql phpmyadmin distance latitude-longitude haversine