Hi,

I am stumped on how to do a particular hierarchical
query. The query needs to be written entirely in SQL.

I have a table (ACCOUNT) with 3 columns of interest in
it, ACCOUNT_ID, ROOT_ID, PARENT_ID. Every row
represents an account. If an account is the "root"
(top-most), then the ROOT_ID and PARENT_ID columns are
null. If an account is a "parent", then the ROOT_ID is
populated but the PARENT_ID is null. Accounts can be
nested multiple levels deep.

I need to find all of the accounts that belong to the
root of the given account but not include any accounts
that are children of the given account. Does this make
sense?

I.e.          5
          6       7
       8     9      10
    11   12    13      14

I'm not sure if my tree diagram will be dispalyed
properly after I email this but in essence if "8" is
the given account number, I want everything returned
except for 8, 11 and 12.

Thanks in advance!
-w




__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Walter K
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to