I have a postgis table with point geometries.
point table:
id | uid | date | geom
Points with the same uidare the same goal. I am trying GROUP BY uidwith ST_MakeLine to create a full LineString target string.
SELECT uid, ST_MakeLine(geom)
FROM points
GROUP BY uid
This works, but I want to make sure the points are in the correct order. I tried to do this by adding ORDER BY datebefore grouping.
SELECT uid, ST_MakeLine(geom)
FROM points
ORDER BY date <
GROUP BY uid
ERROR: syntax error at or near "GROUP"
Is there a way to arrange grouped rows before they are loaded into an aggregate function?
source
share