Re: reusing column labels in select

From: Steven Klassen <sklassen(at)commandprompt(dot)com>
To: ryan <rvanroode(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: reusing column labels in select
Date: 2004-10-19 22:18:46
Message-ID: 20041019221844.GB8293@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

* ryan <rvanroode(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Josh Close 2004-10-19 22:35:14 Re: how much ram do i give postgres?
Previous Message Kevin Barnard 2004-10-19 22:16:01 Re: reusing column labels in select