Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Parent/Child Heirarchy

Author  Topic 

deserel
Starting Member

4 Posts

Posted - 2004-08-16 : 11:36:51
I have 2 tables (categories and category_tree) that identify a category heirarchy.

Table 1:category
category_id
category

Table 2: category_tree
category_tree_id
parent_category_id
category_id
level

What I am trying to replicate is this type of structure


Sports
---Team Sports
------Baseball
------Swimming
---Individual Sports
------Swimming

(------ is there to show indents)

(Swimming has 2 parents and thus shows up in 2 areas).

I am at a wall in getting this to display. I can get one level to display (Sports : Team Sports) but I can't figure out how to get this to dynamically display all levels. (May be anywhere from 2 to 5 levels deep)

Ideally, this would display as (in alphabetical order)

Sports : Team Sports : Baseball
Sports : Team Sports : Swimming

The idea is that people can assign products to these categories via web page. So, I'll probably make this a drop down box.

Thanks in advance for any help!!

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-08-16 : 11:39:50
For reading pleasure: http://www.seventhnight.com/treestructs.asp

Corey
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-08-16 : 11:43:20
well let's link it on:

http://www.sqlteam.com/item.asp?ItemID=8866

:)

Go with the flow & have fun! Else fight the flow :)
Go to Top of Page
   

- Advertisement -