Re: invalid 'having' clause

From: "Iain" <iain(at)mst(dot)co(dot)jp>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: invalid 'having' clause
Date: 2004-12-02 07:46:22
Message-ID: 000e01c4d843$07a83890$7201a8c0@mst1x5r347kymb
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

OK, thanks. That seems to make sense.

regards
Iain
----- Original Message -----
From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Iain" <iain(at)mst(dot)co(dot)jp>
Cc: <pgsql-sql(at)postgresql(dot)org>
Sent: Thursday, December 02, 2004 11:54 AM
Subject: Re: [SQL] invalid 'having' clause

> "Iain" <iain(at)mst(dot)co(dot)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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2004-12-02 08:56:21 Re: SET AUTOCOMMIT TO OFF
Previous Message Tomasz Myrta 2004-12-02 07:18:03 Re: order by problem