referencing to "computed columns" in where clause

Поиск
Список
Период
Сортировка
От Ivan Sergio Borgonovo
Тема referencing to "computed columns" in where clause
Дата
Msg-id 20080129180448.376b5475@webthatworks.it
обсуждение исходный текст
Ответы Re: referencing to "computed columns" in where clause  (Sam Mason <sam@samason.me.uk>)
Re: referencing to "computed columns" in where clause  (Richard Broersma Jr <rabroersma@yahoo.com>)
Список pgsql-general
Is there a way to do things like

select (a-b) as pippo from ... where pippo=7;
or
select
  case
    when (a>3) then a*b
    when (a<3) then a+b
  end as pippo
where pippo<12;

other than defining a function such that I can write:

select func(a,b,c) as pippo from ... where func(a,b,c)=7;
?

Is there anything else I can do to avoid duplication of code?


--
Ivan Sergio Borgonovo
http://www.webthatworks.it


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

Предыдущее
От: "Richard M. Kues"
Дата:
Сообщение: Re: Surprising (?) Sequence Behavior
Следующее
От: Sam Mason
Дата:
Сообщение: Re: referencing to "computed columns" in where clause