Problem with aliasing

Поиск
Список
Период
Сортировка
От Jean-Christian Imbeault
Тема Problem with aliasing
Дата
Msg-id 3E560203.9020207@mega-bucks.co.jp
обсуждение исходный текст
Ответы Re: Problem with aliasing
Список pgsql-general
I wrote a plpgsql function to return the maximum of three dates.

TAL=# select max(req_del_date1, req_del_date2, req_del_date3) as ma1
from invoices;
     ma1
------------
  2003-02-25
  2003-02-25
(2 rows)


However I'm having problems with the following query:

TAL=# select max(req_del_date1, req_del_date2, req_del_date3) as max
from invoices where max <= now();
ERROR:  Attribute "max" not found

Why can't the where part of the query see "max"? I've tried aliasing the
returned value but that did not work either:

TAL=# select max(req_del_date1, req_del_date2, req_del_date3) as ma1
from invoices where ma1 <= now();
ERROR:  Attribute "ma1" not found

What is wrong with my syntax?

Thanks!

Jc


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

Предыдущее
От: "Guido Notari"
Дата:
Сообщение: Re: Backend often crashing
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: max connections