Skip site navigation (1) Skip section navigation (2)

Re: referencing to "computed columns" in where clause

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: referencing to "computed columns" in where clause
Date: 2008-01-29 17:17:39
Message-ID: 20080129171739.GV18990@frubble.xen.chris-lamb.co.uk (view raw or flat)
Thread:
Lists: pgsql-general
On Tue, Jan 29, 2008 at 06:04:48PM +0100, Ivan Sergio Borgonovo wrote:
> select
>   case
>     when (a>3) then a*b
>     when (a<3) then a+b
>   end as pippo
> where pippo<12;

I've tended to do:

  SELECT *
  FROM (
    SELECT "complicated expression" AS pippo) x
  WHERE pippo  < 12;
 

  Sam

In response to

Responses

pgsql-general by date

Next:From: Ivan Sergio BorgonovoDate: 2008-01-29 17:49:50
Subject: Re: referencing to "computed columns" in where clause
Previous:From: Ivan Sergio BorgonovoDate: 2008-01-29 17:04:48
Subject: referencing to "computed columns" in where clause

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group