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

Re: Reuse previously calculated column in sql query?

From: Rod Taylor <pg(at)rbt(dot)ca>
To: Philippe Lang <philippe(dot)lang(at)attiksystem(dot)ch>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Reuse previously calculated column in sql query?
Date: 2004-10-20 13:05:38
Message-ID: 1098277537.747.91.camel@home (view raw or flat)
Thread:
Lists: pgsql-sql
On Wed, 2004-10-20 at 08:50, Philippe Lang wrote:
> Hello,
> 
> Is it possible to reuse a previously calculated column in a following
> column, like:

SELECT col1
     , col2
     , col2 * 0.75 AS col3
  FROM (SELECT foo.val1 AS col1
             , long_calculation(foo.val1) AS col2
          FROM foo) AS tab;



In response to

Responses

pgsql-sql by date

Next:From: WeipingDate: 2004-10-20 14:57:34
Subject: Re: the problem of createlang!
Previous:From: Philippe LangDate: 2004-10-20 12:50:11
Subject: Reuse previously calculated column in sql query?

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