Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with denormalizing a hierarchy

Status
Not open for further replies.

yukonxl

Programmer
Jan 4, 2002
4
US
I have a hierarchy as follows
[tt]
|
_1__
| |_10__
| | |_11
| |
| |
| |_20
| |
| |_30__
| |_31
| |
| |_32
|
_2
|
.
.
.
[/tt]
This hierarchy is stored in a table with child/parent relationship...
TABLE: T_LINK
[tt]LINE# PARENT_LINE# LEVEL
1 - 1
10 1 2
11 10 3
20 1 2
30 1 2
31 30 3
32 30 3
2 - 1[/tt]

The LEVEL represents the "node count" from the top (LEVEL = 1 for LINE# = 1 b/c it is the top node).

I am having trouble denormalizing this information into a "flat" table with the following format (assuming a maximum of eight possible levels):
TABLE: T_LINK_DENORM
[tt]LEVEL1 LEVEL2 LEVEL3 LEVEL4 LEVEL5 LEVEL6 LEVEL7 LEVEL8
1 10 11
1 20
1 30 31
1 30 32
2[/tt]

Any help would be GREATLY appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top