From: | Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com> |
---|---|
To: | Michael Agbaglo <byteshifter(at)shifted-bytes(dot)de>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: syntax for access an alias in the where clause ? |
Date: | 2002-06-19 22:04:27 |
Message-ID: | 20020619220427.58854.qmail@web20810.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
The WHERE clause is evaluated before the SELECT list,
at which point the value of "[alias 1]" is not known.
You will need to use "[expression 1]" there instead.
ORDER BY is evaluated after the SELECT, so "[alias 1]"
can be used there with no problems.
--- Michael Agbaglo <byteshifter(at)shifted-bytes(dot)de>
wrote:
> Hi !
>
> It's long ago since I used SQL :-)
>
> select [expression 1] as [alias 1], [expression 2]
> as [alias 2]
> where [alias 1] < [alias 2]
> order by [alias 2] - [alias 1]
>
> ---> ERROR: Attribute '[alias 1]' not found
>
> I found a lot of 'select [expression] as' but I've
> never seen somebody
> accessing the alias ... Can't this be done ?
>
> M.
>
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
majordomo(at)postgresql(dot)org
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2002-06-19 22:11:38 | Re: syntax for access an alias in the where clause ? |
Previous Message | Tom Lane | 2002-06-19 21:23:16 | Re: syntax for access an alias in the where clause ? |