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 70EEB32A146 for ; Wed, 20 Oct 2004 13:50:22 +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 05817-01 for ; Wed, 20 Oct 2004 12:50:14 +0000 (GMT) Received: from poweredge.attiksystem.ch (adsl-soholight-4-c59-p029.vtx.ch [212.147.59.29]) by svr1.postgresql.org (Postfix) with ESMTP id CC1EC32A11C for ; Wed, 20 Oct 2004 13:50:12 +0100 (BST) Subject: Reuse previously calculated column in sql query? MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Wed, 20 Oct 2004 14:50:11 +0200 Message-ID: <6C0CF58A187DA5479245E0830AF84F42080442@poweredge.attiksystem.ch> Content-Class: urn:content-classes:message X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Reuse previously calculated column in sql query? thread-index: AcS2o1Ytb7tcMRZATASqx0PnAc/2Xg== From: "Philippe Lang" To: 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/142 X-Sequence-Number: 19245 Hello, Is it possible to reuse a previously calculated column in a following column, like: SELECT foo.val1 AS col1, long_calculation(foo.val1) AS col2, COL2 * 0.75 AS col3 FROM foo; instead of writing: SELECT foo.val1 AS col1, long_calculation(foo.val1) AS col2, long_calculation(foo.val1) * 0.75 AS col3 FROM foo; Philippe