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 -> Re: Joining against 0 rows

Re: Joining against 0 rows

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Tue, 01 Feb 2000 19:35:56 +0800
Message-ID: <3896C51C.2E5E@yahoo.com>


david_barts_at_my-deja.com wrote:
>
> Suppose I do a join like:
>
> SELECT table1.some_column, table2.other_column
> FROM table1, table2
> WHERE table1.p_key = table2.f_key
> AND <other conditions which determine table1.p_key>
>
> However, it is legitimate if table2 doesn't have
> corresponding rows; in this case I want to
> return, say, '' in place of table2.other_column.
>
> Is it possible to do it elegantly (without subqueries?)
>
> Thanks very much!
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

Check out outer joins.

SELECT table1.some_column, table2.other_column FROM table1, table2
WHERE table1.p_key = table2.f_key(+)

etc

--



Connor McDonald
"These views mine, no-one elses etc etc" connor_mcdonald_at_yahoo.com

"Some days you're the pigeon, and some days you're the statue." Received on Tue Feb 01 2000 - 05:35:56 CST

Original text of this message

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