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 639893A5D7F for ; Wed, 12 Jan 2005 18:32:34 +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 57205-10 for ; Wed, 12 Jan 2005 18:32:18 +0000 (GMT) Received: from school.digsys.bg (school.digsys.bg [193.68.6.1]) by svr1.postgresql.org (Postfix) with ESMTP id A541A3A5D63 for ; Wed, 12 Jan 2005 18:32:16 +0000 (GMT) Received: from faith.digsys.bg (sigma.digsys.bg [193.68.6.19]) by school.digsys.bg (8.11.6/8.10.1) with ESMTP id j0CIW4D13548; Wed, 12 Jan 2005 20:32:05 +0200 (EET) Message-ID: <41E56ED5.8040005@faith.digsys.bg> Date: Wed, 12 Jan 2005 20:39:17 +0200 From: Kaloyan Iliev Iliev User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040115 X-Accept-Language: en-us, en, bg MIME-Version: 1.0 To: Sam Mason Cc: pgsql-sql@postgresql.org Subject: Re: Problems with HAVING References: <41E5529B.9030609@faith.digsys.bg> <20050112174019.GS14073@sam.samason.me.uk> In-Reply-To: <20050112174019.GS14073@sam.samason.me.uk> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.075 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/68 X-Sequence-Number: 19856 Thanks for the replay first. Yes I use "having" like I have written. I can't use your query because in subquery I must write again the whole WHERE clause. But in the other mail in the tread there is the solution:) Thanks again Kaloyan Sam Mason wrote: >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 > >---------------------------(end of broadcast)--------------------------- >TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > > >