Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CA42A476255 for ; Thu, 12 Sep 2002 09:15:53 -0400 (EDT) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 5BA684761B4 for ; Thu, 12 Sep 2002 09:15:53 -0400 (EDT) Received: by news.hub.org (Postfix, from userid 8) id 45D5A382088; Thu, 12 Sep 2002 09:15:52 -0400 (EDT) From: "Gaetano Mendola" X-Newsgroups: comp.databases.postgresql.sql Subject: Re: Select the max on a field Date: Thu, 12 Sep 2002 15:15:57 +0200 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 29 Message-ID: References: X-Complaints-To: news@hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 To: pgsql-sql@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/98 X-Sequence-Number: 9375 "Gaetano Mendola" wrote in message news:alq3mr$2s7o$1@news.hub.org... > Hi all, > > Suppose that I have a table like this: > > > att_1 | att_2 | att_3 | att_4 > -------------------------------- > 1 | a | y | y1 > 2 | b | y | y2 > 3 | a | xx | y3 > 4 | c | zz | y4 > 5 | a | t | y5 > 6 | c | x | y6 > > > > I want obtain all row that have for each att_2 > the max of att_1 I forgot to say: "with a single total query without sub select " Ciao Gaetano