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: join and trees

Re: join and trees

From: Thomas Sommerfeld <TSommerfeld_at_gmx.de>
Date: Thu, 07 Jun 2007 12:23:54 +0200
Message-ID: <f48miu$iu0$1@online.de>


grasp06110 schrieb:
> /* this returns no records found */
> select
> *
> from
> tree,
> more_info
> where
> tree.child != 'ROOT'
> and tree.child = more_info.child
> start with
> tree.child = 'ROOT'
> connect by
> tree.parent = prior tree.child

Hi,

the problem is that there is no corresponding row in more_info regarding your start node in tree. So just make an outer join and it works select

   *
from

   tree,
   more_info
where

   tree.child != 'ROOT'
   and tree.child = more_info.child (+)
start with

   tree.child = 'ROOT'
connect by

   tree.parent = prior tree.child;

or
select

   *
from

   tree
   left outer join more_info on tree.child = more_info.child where

   tree.child != 'ROOT'
start with

   tree.child = 'ROOT'
connect by

   tree.parent = prior tree.child;

HTH
Thomas

-- 
For answers by personal mail use: thomas.sommerfeld at domain ust-gmbh.de
Received on Thu Jun 07 2007 - 05:23:54 CDT

Original text of this message

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