I have a pointfile of approx.. 226000 points, where I need to filter by max value and distinct id_pol.
SELECT distinct (id_pol), MAX(value)
FROM fillspill_pol_value
GROUP BY id_pol;
This expression gives me 460 rows, which is correct, but when I add geometry to the selection, it gives me 226000 rows. How can I select only the geometry for the 460 points (the max values)?