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 446AD3A5D01 for ; Wed, 12 Jan 2005 16:31:59 +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 38904-06 for ; Wed, 12 Jan 2005 16:31:45 +0000 (GMT) Received: from school.digsys.bg (school.digsys.bg [193.68.6.1]) by svr1.postgresql.org (Postfix) with ESMTP id 9EB833A5D1B for ; Wed, 12 Jan 2005 16:31:42 +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 j0CGVdD12883 for ; Wed, 12 Jan 2005 18:31:39 +0200 (EET) Message-ID: <41E5529B.9030609@faith.digsys.bg> Date: Wed, 12 Jan 2005 18:38:51 +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: pgsql-sql@postgresql.org Subject: Problems with HAVING Content-Type: multipart/alternative; boundary="------------030103060809030403080602" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, HTML_40_50, HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: X-Archive-Number: 200501/54 X-Sequence-Number: 19842 This is a multi-part message in MIME format. --------------030103060809030403080602 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hello, My problem is that I want to select the row with max(date) but also limited with where clauses. Select test.name from test where test.name = foo.name having max(test.date) This is a subquery and is part bigger query. How I can select the row with the max query. ERROR: argument of HAVING must be type boolean, not type date This is the error I receive. As far as I know I can't use agregate functions in where clause. Thank you in advance. Kaloyan Iliev --------------030103060809030403080602 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Hello,

My problem is that I want to select the row with max(date) but also limited with where clauses.

Select
test.name
from
 test
where
test.name = foo.name
having max(test.date)

This is a subquery and is part bigger query. How I can select the row with the max query.
ERROR:  argument of HAVING must be type boolean, not type date

This is the error I receive.
As far as I know I can't use agregate functions in where clause.

Thank you in advance.

Kaloyan Iliev


--------------030103060809030403080602--