X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7569E32A207 for ; Wed, 20 Oct 2004 14:08:43 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09557-06 for ; Wed, 20 Oct 2004 13:08:29 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0D60432A263 for ; Wed, 20 Oct 2004 14:08:32 +0100 (BST) Received: from [134.22.69.212] (dyn-69-212.tor.dsl.tht.net [134.22.69.212]) by tht.net (Postfix) with ESMTP id 4820076A38; Wed, 20 Oct 2004 09:06:31 -0400 (EDT) Subject: Re: Reuse previously calculated column in sql query? From: Rod Taylor To: Philippe Lang Cc: pgsql-sql@postgresql.org In-Reply-To: <6C0CF58A187DA5479245E0830AF84F42080442@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F42080442@poweredge.attiksystem.ch> Content-Type: text/plain Message-Id: <1098277537.747.91.camel@home> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Wed, 20 Oct 2004 09:05:38 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/143 X-Sequence-Number: 19246 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;