Thread: smart(er) column aliases

smart(er) column aliases

From
"Iain Sinclair"
Date:
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