I'm using postgresql to calculate if different points are inside a specific range (calculated using pythagoras).
The thing is that I would like to get the results ordered by the proximity instead of randomly.
This is my query:
select * from point l where ((abs(l.lat*111139 - myPointLat*111139)^2) + (abs(l.lng*111139 - (myPointLng*111139))^2)) <= metres^2;
And I would like to sort it using this part of the query:
((abs(l.lat111139 - myPointLat111139)^2) + (abs(l.lng111139 - (myPointLng111139))^2))
How could I achieve this?
Thank you very much!