Just want to add: > 1) Display the rows with the highest date per id. That gives as many rows as > ids exist. > > select id, max(date) from mytable group by id; > > gives just the id and the date, not the other values. I think of doing this > in two steps: select id, max(date),min,value,max from mytable group by id,min,value,max; Gives too many rows. I don't know why. If I can manage to fix the query above just to output one row per id I can solve it. Marco -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general