I need to display the max of count for this query. I tried a nested way but I could not get it to return the centroid of that cell.
Here flickr_edin table data consists of points and grid100m table data contains polygons
SELECT Max(P_density) FROM(COUNT(a.geom) as P_density,ST_ASTEXT(ST_CENTROID(b.geom)) FROM flickr_edin a JOIN grid100m b ON ST_WITHIN(a.geom, b.geom) GROUP BY b.geom ORDER BY P_density DESC) A;
How should I frame it instead so I can get the centroid point returned as well?