Search Postgresql Archives

referencing to "computed columns" in where clause

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux