Re: [SQL] invalid 'having' clause

2004-12-02 Thread Iain
OK, thanks. That seems to make sense. regards Iain - Original Message - From: "Tom Lane" <[EMAIL PROTECTED]> To: "Iain" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, December 02, 2004 11:54 AM Subject: Re:

Re: [SQL] invalid 'having' clause

2004-12-01 Thread Tom Lane
"Iain" <[EMAIL PROTECTED]> 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,

[SQL] invalid 'having' clause

2004-12-01 Thread Iain
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 g