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

Home -> Community -> Usenet -> c.d.o.tools -> Re: SELECT

Re: SELECT

From: Wendy Smiley <wendy01_at_charter.net>
Date: Sun, 28 Jan 2001 15:35:49 -0600
Message-ID: <t7949g602vaa20@corp.supernews.com>

Use an outer join, by adding (+) after the column name for the table that has the missing row.

select table1.name,table1.phonenumber,table2.age from table1,table2 where table1.name=table2.name (+);

Mike.

<bing-du_at_tamu.edu> wrote in message news:95218v$al2$1_at_nnrp1.deja.com...
> In one of my cgi program, I need to query the Oracle database for some
> data. Here is my question.
>
> table1:
>
> name phonenumber
> ---- ----------
> one 111
> two 222
>
> table2:
>
> name age
> ---- ---
> one 33
>
> select table1.name,table1.phonenumber,table2.age from table1,table2
> where table1.name=table2.name;
>
> From my understanding, the above SELECT statement only returns the the
> following result:
>
> name phonenumber age
> ---- ----------- ---
> one 111 33
>
> My question is how I can get the following result?
>
> name phonenumber age
> ---- ----------- ---
> one 111 33
> two 222
>
> Any help would be appreciated!
>
> Bing
>
>
> Sent via Deja.com
> http://www.deja.com/
Received on Sun Jan 28 2001 - 15:35:49 CST

Original text of this message

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