NYCPHP Meetup

NYPHP.org

[nycphp-talk] Building trees

Tim Sailer sailer at bnl.gov
Wed Oct 16 16:45:46 EDT 2002


On Wed, Oct 16, 2002 at 04:16:36PM -0400, Jim Hendricks wrote:
> That's what I'm doing now, but in order to build the whole tree requires 
> multiple queries with this design. My latest idea is to add a tierlevel 
> field so I won't have to issue a query for parentID = 0 ( top level ) 
> then iterate this result & generate a query for parentID = the id of the 
> row we are on in top level etc. right on down the line.  If I have 4 top 
> level projects each with 3 sub projects and 1 of the subprojects have 2 
> subprojects this would require issuing 1 toplevel query, 4 2nd level 
> queries,  12 3rd level queries, and 2 4th level queries.  All told for 
> this simple tree I will have issued 19 queries.  If I have a tierlevel 

Those of you (if any) from a manufacturing background will see this as
the way a Bill of Materials (BOM) is built for a product. A product is
built from subassemblies, which are built from either other subs or
individual components (greatly simplified). This is a tried and tested
way of building trees.

Tim

-- 
Tim Sailer <sailer at bnl.gov> 
Application Services
Information Technology Division
Brookhaven National Laboratory  (631) 344-3001



More information about the talk mailing list