invalid 'having' clause

From: "Iain" <iain(at)mst(dot)co(dot)jp>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: invalid 'having' clause
Date: 2004-12-02 02:22:56
Message-ID: 001601c4d815$d8f03430$7201a8c0@mst1x5r347kymb
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

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

This isn't valid in pg (7.4.6), but this is:

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

Does anyone have any idea?

I can't remember what other databases do, and I'm not so familiar with the
standards, but I just thought I'd mention it anyway.

regards
Iain

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Fuhr 2004-12-02 02:45:56 Re: grouping a many to many relation set
Previous Message Tom Lane 2004-12-02 01:53:11 Re: find the "missing" rows