X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id D1A74D1B50B for ; Wed, 17 Sep 2003 08:19:48 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 59637-06 for ; Wed, 17 Sep 2003 05:19:16 -0300 (ADT) Received: from hotmail.com (sea2-f62.sea2.hotmail.com [207.68.165.62]) by svr1.postgresql.org (Postfix) with ESMTP id 28B1ED1B4E1 for ; Wed, 17 Sep 2003 05:19:14 -0300 (ADT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Wed, 17 Sep 2003 01:19:15 -0700 Received: from 80.205.253.69 by sea2fd.sea2.hotmail.msn.com with HTTP; Wed, 17 Sep 2003 08:19:15 GMT X-Originating-IP: [80.205.253.69] X-Originating-Email: [martinkuria@hotmail.com] From: "Martin Kuria" To: pgsql-sql@postgresql.org Subject: sub query Date: Wed, 17 Sep 2003 11:19:15 +0300 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 17 Sep 2003 08:19:15.0753 (UTC) FILETIME=[622DA990:01C37CF4] X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/147 X-Sequence-Number: 15125 Hi I have this problem, when I try to run this query: SELECT MAX(d), host_position FROM (SELECT host_position, COUNT(host_position) as d FROM sss_host GROUP BY host_position) as e; am getting and ERROR: Attribute e.host_position must be GROUPed or used in an aggregate function. Please to advice what could be the problem and how can I rewrite it to work thanks in advance. Kind regards +-----------------------------------------------------+ | Martin W. Kuria (Mr.) martin.kuria@unon.org +----------------------------------------------------+ _________________________________________________________________ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail