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.volpe@gtngroup.it>
To: "Postgresql" <pgsql-general@postgresql.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@postgresql.org so that your
> message can get through to the mailing list cleanly
>
>