Re: where cannot use alias name of column?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Giorgio Volpe <giorgio(dot)volpe(at)gtngroup(dot)it>
Cc: Postgresql <pgsql-general(at)postgresql(dot)org>
Subject: Re: where cannot use alias name of column?
Date: 2001-09-13 14:23:26
Message-ID: Pine.BSF.4.21.0109130722150.35960-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 13 Sep 2001, Giorgio Volpe wrote:

> 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

Because the select list (the key as cc part) isn't
evaluated until after the where clause determines
which rows to evaluate it for.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Eckermann 2001-09-13 14:23:49 Re: where cannot use alias name of column?
Previous Message haifa touati 2001-09-13 14:05:43