Simple form, infinite levels.  All you need are three columns

ID
Parent ID
Desc

ID    Parent ID      Desc
-----------------------------------
1     -1                Root
2     1                 First Child
3     1                 Second Child
4     3                Grandchild A
5     3                Grandchild B
etc...

You can walk the hierarchy in either direction.

Check out tree walking, recursive trees, etc.  For example,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvbadev/html/traversingtreewalkingcode.asp


On 9/29/05, Charles Carroll <[EMAIL PROTECTED]> wrote:
> Recursion. Research it.
>
> On 9/29/05, Mike Appenzellar <[EMAIL PROTECTED]> wrote:
> >
> >  I have a database structure setup as follows:
> > ID NAME PID
> > 1 Level1 0
> > 2 Level2 0
> > 3 Level3 0
> > 4 SubLevel1 1
> > 5 SubLevel2 2
> > 6. SubSub1 4
> > and so on...
> > Right now I have nested loops that take care of this BUT the problem is
> > that I have to pre-plan on how many potential levels there might be. I
> > would
> > like to somehow right my queries or loops to plan for an unlimitied amount
> > of levels.....any ideas?
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>


--
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to