I am trying to calculate distance from given Point(lat, long)
but when I use an ordering by the distance column I get Commands out of sync; you can't run this command now
error.
Here is my query:
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
If I remove ORDER BY
clause, it executes fine. Is there any way I can calculate distance and get places which are certain distance far from my provided latitude & longitude
?