Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Simple SQL question

Simple SQL question

From: Paul Taylor <paul.taylor_at_zen.co.uk>
Date: Sat, 07 Dec 2002 09:49:06 +0000
Message-ID: <4ig3vu42pp3m54q42ha6k2bokkck2541pr@4ax.com>


I can't seem to find the answer to this question anywhere.

If I have a query such as:

SELECT x/2, y+3 FROM mytable;

Is it possible to use the calculated values x/2 and y+3 in another column? I was thinking of something like:

SELECT x/2 AS a, y+3 AS b, a + b FROM mytable;

I'm thinking more of cases where the expressions would be a lot more complex (like nested SELECTS). I have a situation where I have 2 nested selects and I want to perform a calculation on the results and use that as a third column. Is there some way to do what I want? In the example above I get an error stating that columns a and b don't exist.

Thanks. Received on Sat Dec 07 2002 - 03:49:06 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US