Re: How change col name during query to use it in where clause

Поиск
Список
Период
Сортировка
От Oliveiros d'Azevedo Cristina
Тема Re: How change col name during query to use it in where clause
Дата
Msg-id 340C84580192462E94F2EF130C1C078D@marktestcr.marktest.pt
обсуждение исходный текст
Ответ на How change col name during query to use it in where clause  (Marcel Ruff <mr@marcelruff.info>)
Список pgsql-sql
I'm affraid
you can't.


AFAIK,
WHERE clause is processed before the SELECT output expressions

Best,
Oliveiros
----- Original Message ----- 
From: "Marcel Ruff" <mr@marcelruff.info>
To: <pgsql-sql@postgresql.org>
Sent: Friday, May 04, 2012 11:25 AM
Subject: [SQL] How change col name during query to use it in where clause


> Hi,
>
> is an alias name not usable in the where clause?
>
> select EXTRACT(day from enddate::TIMESTAMP - old_enddate::TIMESTAMP) AS 
> TAGE  from account_h  where TAGE>5;
> ERROR:  column "tage" does not exist
> LINE 1: ... TAGE>5 ...
>
> Thank you
> Marcel
>
> -- 
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql 



В списке pgsql-sql по дате отправления:

Предыдущее
От: Marcel Ruff
Дата:
Сообщение: How change col name during query to use it in where clause
Следующее
От: Andreas Kretschmer
Дата:
Сообщение: Re: How change col name during query to use it in where clause