field alias in where condition

From: Havasvölgyi Ottó <h(dot)otto(at)freemail(dot)hu>
To: <pgsql-general(at)postgresql(dot)org>
Subject: field alias in where condition
Date: 2005-06-03 14:28:24
Message-ID: 000701c56848$7fed4f80$6c00a8c0@OTTO
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I issued the following queries:

select substring(proname from 1 to 1) as nevresz, count(*)
from pg_proc
where nevresz = 'a'
order by nevresz
group by nevresz;

select substring(proname from 1 to 1) as nevresz, count(*)
from pg_proc
order by nevresz
group by nevresz;

The first query fails, and says that column 'nevresz' does not exist.
The second is OK.

What is the problem? I cannot use column alias in where condition?

Thanks,
Otto

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2005-06-03 14:39:25 Re: PG Lightning Admin running on Linux via WINE 2005524
Previous Message Bruno Wolff III 2005-06-03 14:02:07 Re: adding columns with defaults is not implemented