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

Home -> Community -> Usenet -> c.d.o.server -> Re: select column with a select statement

Re: select column with a select statement

From: James Petts <jpetts_at_celltech.co.uk>
Date: Thu, 18 Feb 1999 08:47:04 GMT
Message-ID: <36cbd24a.847527850@firewall.celltech>


On Wed, 17 Feb 1999 13:10:01 -0700, Naushi Hussain <Naushi.Hussain_at_Alliedsignal.com> wrote:

>Can we select a column using a select statement, in a select statement;
>e.g.
>
>select col a, col b, (select col x from table B where ....), col c from
>table A

Use table aliases:

SELECT A.col_a, A.col_b, B.col_x
  FROM table_A A, table_B B

If the column names are unique within the tables from which you are SELECTing, then you do not need aliases, and

SELECT col_a, col_b, col x
  FROM table_A, table_B

will work. You will almost certainly want a WHERE clause though, otherwise you get the Cartesian product of table_A and table_B which is probably not what you want. Received on Thu Feb 18 1999 - 02:47:04 CST

Original text of this message

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