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 CD9093A5D75 for ; Wed, 12 Jan 2005 17:40:29 +0000 (GMT) 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 51140-01 for ; Wed, 12 Jan 2005 17:40:21 +0000 (GMT) Received: from outmail.freedom2surf.net (outmail1.freedom2surf.net [194.106.33.237]) by svr1.postgresql.org (Postfix) with ESMTP id ECA453A5D70 for ; Wed, 12 Jan 2005 17:40:20 +0000 (GMT) Received: from sam.samason.me.uk (sam.samason.me.uk [195.137.31.118]) by outmail.freedom2surf.net (8.12.10/8.12.10) with ESMTP id j0CHeJnF031565 for ; Wed, 12 Jan 2005 17:40:19 GMT Received: by sam.samason.me.uk (Postfix, from userid 1000) id 1EE1A63716; Wed, 12 Jan 2005 17:40:19 +0000 (GMT) Date: Wed, 12 Jan 2005 17:40:19 +0000 From: Sam Mason To: pgsql-sql@postgresql.org Subject: Re: Problems with HAVING Message-ID: <20050112174019.GS14073@sam.samason.me.uk> Mail-Followup-To: pgsql-sql@postgresql.org References: <41E5529B.9030609@faith.digsys.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <41E5529B.9030609@faith.digsys.bg> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/62 X-Sequence-Number: 19850 Kaloyan Iliev Iliev wrote: >select test.name >from test >where test.name = foo.name >having max(test.date) I don't think you use the "having" clause like you've done there. I think you want to be doing something more like: select test.name from test where test.name = foo.name and test.date in (select max(date) from test); But I may have misinterpreted you. . . Cheers, Sam