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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Removing duplicate subtrees from CONNECT-BY query

Re: Removing duplicate subtrees from CONNECT-BY query

From: Maxim Demenko <mdemenko_at_gmail.com>
Date: Sun, 07 Oct 2007 21:54:39 +0200
Message-ID: <4709397F.1080902@googlemail.com>


Riku Räsänen schrieb:
Depends on the criteria, which subtrees you like to retain. For example, if you wish to reject all except under the first parent_id (first in sense of ordered by parent_id), you could do something like SELECT LPAD (' ', (LEVEL - 1) * 2) || TO_CHAR (id, '999') id

     , parent_id
  FROM (select id,min(parent_id) parent_id from tree_hierarchy group by id) START WITH id = 1
CONNECT BY PRIOR id = parent_id

Best regards

Maxim

--
http://www.freelists.org/webpage/oracle-l
Received on Sun Oct 07 2007 - 14:54:39 CDT

Original text of this message

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