Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f2CK8rx57201 for ; Mon, 12 Mar 2001 15:08:53 -0500 (EST) (envelope-from pgsql-sql-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f27DUCx70399 for ; Wed, 7 Mar 2001 08:30:12 -0500 (EST) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.1/8.11.1) id f27DOcO90166 for pgsql-sql@postgresql.org; Wed, 7 Mar 2001 08:24:38 -0500 (EST) (envelope-from news) From: Salvador =?iso-8859-1?Q?Main=E9?= X-Newsgroups: comp.databases.postgresql.sql Subject: SQL problem Date: Wed, 07 Mar 2001 13:23:23 -0100 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 22 Message-ID: <3AA6445B.F409966F@yahoo.com> Reply-To: salva@ronincoders.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: scrappy@hub.org X-Mailer: Mozilla 4.75 [es] (X11; U; Linux 2.2.16-22 i586) X-Accept-Language: en To: pgsql-sql@postgresql.org X-Archive-Number: 200103/227 X-Sequence-Number: 1881 Hello: I have a table with pluviometrical data meteo (rain float, day date) I want to select the the day of maximum value for each year.It should be something like : select max(rain),day from meteo group by date_part('year', day); but it obiously doesn't work. I thought of doing it with aggregates, but it's far too complicated. Is there an 'easy' way to do this? -- Salva