Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f2CNKsx95579 for ; Mon, 12 Mar 2001 18:20:54 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.1/8.11.1) with ESMTP id f2CNKot07539; Mon, 12 Mar 2001 18:20:50 -0500 (EST) To: salva@ronincoders.com cc: pgsql-sql@postgresql.org Subject: Re: I need an aggregate with 2 parameters In-reply-to: <3AA75167.68073235@yahoo.com> References: <3AA75167.68073235@yahoo.com> Comments: In-reply-to Salvador =?iso-8859-1?Q?Main=E9?= message dated "Thu, 08 Mar 2001 08:31:19 -0100" Date: Mon, 12 Mar 2001 18:20:50 -0500 Message-ID: <7536.984439250@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200103/234 X-Sequence-Number: 1893 Salvador =?iso-8859-1?Q?Main=E9?= 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