Re: invalid 'having' clause - Mailing list pgsql-sql

From Tom Lane
Subject Re: invalid 'having' clause
Date
Msg-id 1697.1101956079@sss.pgh.pa.us
Whole thread Raw
In response to invalid 'having' clause  ("Iain" <iain@mst.co.jp>)
List pgsql-sql
"Iain" <iain@mst.co.jp> writes:
> Just a quick question out of curiosity, I was just wondering if this is 
> supposed to be valid sql:

> select count(*) as cnt
> from sometable
> group by somecolumn
> having cnt > 1

No.  The HAVING clause logically executes before the SELECT output list
does, so it makes no sense for it to refer to the output list entries.
        regards, tom lane


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Found Large Files.. what objects are they?
Next
From: Michael Fuhr
Date:
Subject: Re: Query is slower