Salvador Mainé <salvamaine@yahoo.com> writes:
> I want to select the the day of maximum value for each year for a given
> measurement station.
This is exactly the sort of thing that SELECT DISTINCT ON is meant for.
See the "weatherReports" example in the SELECT man page,
http://www.postgresql.org/devel-corner/docs/postgres/sql-select.html
regards, tom lane