smart(er) column aliases

From: "Iain Sinclair" <iain(at)mst(dot)co(dot)jp>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: smart(er) column aliases
Date: 2003-10-10 05:51:54
Message-ID: 003501c38ef2$9c041950$6501a8c0@local.mst.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi all,

To take a simple example here is what I wanted to do:

select 1 as one, 2 as two, one + two as three;

but it doesn't work. I've checked it out though, and I found that I can do
this:

select one, two, one + two from (select 1 as one, 2 as two) as a;

which is acceptable, I guess.

I'm using 7.1 (I think) and will update to 7.3 soon but I guess that the
first query still doesn't work.

I'd just like to suggest to the gurus developing this DB that it would be
realy cool if the first query was possible. For me it's just about 2 things:
simplicity and efficiency. The queries I'm working on at the moment are a
little too complex for my liking and the "1" in this example is typically a
call to a very involved function whose result is re-used in a number of
calculations. Obviously, I only want to so it once, and and I want to keep
the main query as simple as possible as things are already out of hand...

cheers all.

Iain

Browse pgsql-sql by date

  From Date Subject
Next Message Marek Lewczuk 2003-10-10 07:53:11 Re: SQL query problem (many table in FROM statement and many LEFT JOIN's)
Previous Message Stuart Barbee 2003-10-10 03:51:24 Re: SQL query problem