Re: reusing column labels in select - Mailing list pgsql-general

From Steven Klassen
Subject Re: reusing column labels in select
Date
Msg-id 20041019221844.GB8293@commandprompt.com
Whole thread Raw
In response to reusing column labels in select  (rvanroode@gmail.com (ryan))
List pgsql-general
* ryan <rvanroode@gmail.com> [2004-10-16 11:18:48 -0700]:

> Is there any way to reuse a column label in a select list like this:
>
>    SELECT 1 + 1 AS a, a + 1 AS b;
>
> I vaguely remember being able to do something like this in oracle. Any
> ideas? Thanks!

You could nest them...

xinu=> select (1 + 1) + 1 as answer;
 answer
--------
      3
(1 row)

--
Steven Klassen - Lead Programmer
Command Prompt, Inc. - http://www.commandprompt.com/
PostgreSQL Replication & Support Services, (503) 667-4564

pgsql-general by date:

Previous
From: Kevin Barnard
Date:
Subject: Re: reusing column labels in select
Next
From: Josh Close
Date:
Subject: Re: how much ram do i give postgres?