X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4A3355332B for ; Tue, 19 Apr 2005 02:03:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41161-09 for ; Tue, 19 Apr 2005 05:03:26 +0000 (GMT) Received: from ausimss.pervasive.com (ausimss.pervasive.com [66.45.103.246]) by svr1.postgresql.org (Postfix) with ESMTP id 559F253237 for ; Tue, 19 Apr 2005 02:03:24 -0300 (ADT) Received: from ausbayes1.aus.pervasive.com ([172.16.8.6]) by ausimss.pervasive.com with InterScan Messaging Security Suite; Tue, 19 Apr 2005 00:03:23 -0500 Received: from ausmail2k3.aus.pervasive.com ([172.16.4.8]) by ausbayes1.aus.pervasive.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 19 Apr 2005 00:03:22 -0500 Received: from BLRMAIL1.aus.pervasive.com ([10.3.16.60]) by ausmail2k3.aus.pervasive.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 19 Apr 2005 00:03:21 -0500 content-class: urn:content-classes:message Subject: Re: SQL group select question MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Tue, 19 Apr 2005 10:33:17 +0530 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Message-ID: <02767D4600E59A4487233B23AEF5C59922C28F@blrmail1.aus.pervasive.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SQL] SQL group select question Thread-Index: AcVEgxD9xMx/v/G/T0qfnU71/WSi6QAGgszw From: "Ramakrishnan Muralidharan" To: "Dave Roe" , X-OriginalArrivalTime: 19 Apr 2005 05:03:22.0439 (UTC) FILETIME=[1C3F4570:01C5449D] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.928 tagged_above=0 required=5 tests=UPPERCASE_50_75 X-Spam-Level: X-Archive-Number: 200504/344 X-Sequence-Number: 21237 Hi, The following SQL query will fetch you result based on the example given = below, SELECT T.ID , T.VALUE FROM ( SELECT MAX( NUMB ) AS NUMB , NAME FROM = TEST3 GROUP BY NAME ) AS A , TEST3 T WHERE A.NAME =3D T.NAME AND A.NUMB =3D T.NUMB=20 ORDER BY T.ID DESC Regards, R.Muralidharan