PostgreSQL aggregate field
I have a table called served_location, which have the latitude and longitude of a place, and im using input parameters $latitude and $longitude to calculate the distance between the input and places in database, everything is working fine, im grouping by the user that serve that location, and using earthdistance to bring the distance from the $latitude, $longitude parameters.
The problem is: im ordering by the minor distance, now i need to bring the name of that location with the minor distance, but im not able to, as the earthdistance will calculate and bring only the number and i can’t use aggregate functions in SELECT FILTER subquery.