From: Philippe Lang <philippe.lang@attiksystem.ch>
To: pgsql-sql@postgresql.org
Subject: Reuse previously calculated column in sql query?
Date: Wed, 20 Oct 2004 14:50:11 +0200
Message-ID: <6C0CF58A187DA5479245E0830AF84F42080442@poweredge.attiksystem.ch> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: philippe.lang@attiksystem.ch
Subject: Re: Reuse previously calculated column in sql query?
In-Reply-To: <6C0CF58A187DA5479245E0830AF84F42080442@poweredge.attiksystem.ch>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox