Re: Hierarchical Query Question
Date: 1997/01/18
Message-ID: <19970118201000.PAA18091_at_ladder01.news.aol.com>#1/1
From original note>>
I need to be able to start at the top of a hierarchy (100 below) and
perform a sum on a column (say PRICE) in each record. The catch is that
the summation can only include those records where a flag (represented
by the =91*=92 below) is set to TRUE <<
I can not really tell from your original note, but Oracle provides the connect by clause for use in traveling a tree structure. Your table must have a column that refers back to a parent row, i.e., manager = employee or parent part = part.
If only the sum is important then you can usually replace a connect by with an outer join and get better performance for a selected subset of the rows which your flag would indicate.
I think your answer depends on how the hierarchary is identified in the table.
Good luck, recursive relationships give me a headache. Received on Sat Jan 18 1997 - 00:00:00 CET