0

I found a sample of code

SELECT *
FROM locator
WHERE SQRT(POW(X(center) - 49.843317 , 2) + POW(Y(center) - 24.026642, 2)) * 100 < radius

in this question Find points within a distance using MySQL.

How can I add an ORDER BY distance to this code?

Taras
  • 32,823
  • 4
  • 66
  • 137
runback
  • 1
  • 1

1 Answers1

1

Please change your query as following

SELECT *
FROM locator
WHERE SQRT(POW(X(center) - 49.843317, 2) + POW(Y(center) - 24.026642, 2)) * 100 < radius
ORDER BY SQRT(POW(X(center) - 49.843317, 2) + POW(Y(center) - 24.026642, 2)) * 100
Taras
  • 32,823
  • 4
  • 66
  • 137