Re: where cannot use alias name of column?

From: "Jeff Eckermann" <jeckermann(at)verio(dot)net>
To: "Giorgio Volpe" <giorgio(dot)volpe(at)gtngroup(dot)it>, "Postgresql" <pgsql-general(at)postgresql(dot)org>
Subject: Re: where cannot use alias name of column?
Date: 2001-09-13 14:23:49
Message-ID: 012701c13c5f$b6287930$279c10ac@INTERNAL
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The WHERE clause is evaluated before the SELECT list, so the column aliases
are not available to be used at that point.
You can get away with using column alias in a GROUP BY (and SORT BY as
well?), but I believe that is not standard SQL.

----- Original Message -----
From: "Giorgio Volpe" <giorgio(dot)volpe(at)gtngroup(dot)it>
To: "Postgresql" <pgsql-general(at)postgresql(dot)org>
Sent: Thursday, September 13, 2001 6:25 AM
Subject: [GENERAL] where cannot use alias name of column?

> May be it's my ignorance about sql ...
> but why cannot i use alias name of a column in a where clause?
>
>
> # select key as cc from mytable where cc > 0;
> ERROR: Attribute 'cc' not found
>
>
> --
>
> Giorgio
>
> -----------------------------------------
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Leandro Rodrigo Saad Cruz 2001-09-13 14:39:27 Bad date external representation Was :[problems using pg_dump and datestyle format]
Previous Message Stephan Szabo 2001-09-13 14:23:26 Re: where cannot use alias name of column?