Postgres First_Value em Gropby

try using "DISTINCT" instead of "GROUP BY", then use the "PARTITION BY"
clause inside the first_value.
GutoTrosla