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: SQL Outer Join Problem

Re: SQL Outer Join Problem

From: <no.email_at_no.spam>
Date: Fri, 01 Sep 2000 05:39:22 GMT
Message-ID: <20000901.5392271@slu40736.hae.hydro.com>

You can try this:

SELECT *
FROM etable e,
  (SELECT *
   FROM otable, utable
   WHERE otable.uid = utable.id) o
WHERE e.oid = o.id(+)

If you have columns in utable with the same name as in otable, you shoul d
alias the column names in the inner select.

Marc

>>>>>>>>>>>>>>>>>> Oorspronkelijk bericht <<<<<<<<<<<<<<<<<<

Op 2000-08-31, 14:08:31, schreef "Mike DiChiappari" <mike_at_mysticsoft.com
>

over het thema SQL Outer Join Problem:

> Hello,
 

> I am having trouble with a query that involves using an outer join.
 

> I have three tables: etable, utable, and otable. There are relationsh
 ips
> between etable<->otable and otable<->utable. I would like to do an ou
 ter
> join between etable and otable so that all records in etable are
 returned,
> even when a NULL exists in etable's foreign key into otable. So far t
his
is
> easy:
 

> SELECT * FROM etable, otable WHERE etable.oid = otable.id (+) AND
...

> However, in the case where etable.oid is not NULL I would like to do a
 

join
> between otable and utable. Note that the following doesn't work (or m
 ake
> sense really).
 

> SELECT * FROM etable, otable, utable WHERE etable.oid = otable.id
(+)
AND
> otable.uid = utable.id
 

> Is there a way to do this?
 

> Thanks,
> Mike
Received on Fri Sep 01 2000 - 00:39:22 CDT

Original text of this message

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