Re: WHERE on an alias - Mailing list pgsql-sql

From Josh Berkus
Subject Re: WHERE on an alias
Date
Msg-id web-108012@davinci.ethosmedia.com
Whole thread Raw
In response to Re: WHERE on an alias  (Joseph Shraibman <jks@selectacast.net>)
List pgsql-sql
Joseph,

> playpen=# SELECT a, sum(b) as dsum
> playpen-# FROM taba
> playpen-# GROUP BY a
> playpen-# HAVING dsum > 5;

Sorry, my mistake:

SELECT a, sum(b) as dsum
FROM taba
GROUP BY a
HAVING sum(b) > 5;

I had the impression that aliases for aggregates were allowed in
Postgres HAVING clauses.  Apparently not.

-Josh

______AGLIO DATABASE SOLUTIONS___________________________                                      Josh Berkus Complete
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco
 


pgsql-sql by date:

Previous
From: Joseph Shraibman
Date:
Subject: Re: WHERE on an alias
Next
From: "Josh Berkus"
Date:
Subject: Indexing and performance