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

Home -> Community -> Usenet -> comp.databases.theory -> Re: Nested sort, trying again

Re: Nested sort, trying again

From: -CELKO- <jcelko212_at_earthlink.net>
Date: 8 Oct 2005 16:02:51 -0700
Message-ID: <1128812571.048600.211820@z14g2000cwz.googlegroups.com>


>> but I believe that the *direct* children of a given node can be found with the following query: <<

To convert a nested sets model into an adjacency list model:

SELECT B.emp AS boss, E.emp
  FROM OrgChart AS E

       LEFT OUTER JOIN
       OrgChart AS B
       ON B.lft
          = (SELECT MAX(lft)
               FROM OrgChart AS S
              WHERE E.lft > S.lft
                AND E.lft < S.rgt);
Received on Sat Oct 08 2005 - 18:02:51 CDT

Original text of this message

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