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