Re: reference to 'as' field

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Frank Bax <fbax(at)sympatico(dot)ca>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: reference to 'as' field
Date: 2005-09-01 18:00:41
Message-ID: 20050901180041.GA42660@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Thu, Sep 01, 2005 at 11:11:59AM -0400, Frank Bax wrote:
>
> When I use "select (f1+f2+f3+f4+f5) as f0 ..." in 7.4.3, it seems I can use
> "f0" is "order by", but not "where" clause [column 'f0' does not
> exist]? Does this change in more current versions? Is there a list of
> which clauses support this syntax in which versions?

Here's an excerpt from the SELECT documentation for 8.0 (8.1beta
says the same thing):

"Using the clause AS output_name, another name can be specified for
an output column. This name is primarily used to label the column
for display. It can also be used to refer to the column's value
in ORDER BY and GROUP BY clauses, but not in the WHERE or HAVING
clauses; there you must write out the expression instead."

http://www.postgresql.org/docs/8.0/static/sql-select.html

--
Michael Fuhr

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Nabil Sayegh 2005-09-01 18:29:59 remembering multiple currval() inside a RULE
Previous Message operationsengineer1 2005-09-01 16:40:22 Debian PostgreSQL Install