I have a table with part and sub-part numbers such as:
Part No Sub-Part No
p1 sp1a
p1 sp1b
p1 sp1c
sp1a s-sp1a1
sp1a s-sp1a2
sp1c s-sp1c
s-sp1a1 s-s-sp1a1a
s-sp1a1 s-s-sp1a1b
s-s-sp1a1b s-s-s-sp1a1a
s-s-s-sp1a1a
There is a main part number (sp1) that has 1 or more sub-part numbers. Each sub-part number may have 1 or more sub-part numbers of it's own. So there is a grandparent-parent-child etc relationship that may be many levels deep. I do no know how many levels there are for any of the parts or subparts.
This process will be passed the main part number (p1). I need to write a stored procedure that will return all of the related part numbers such as the "part no" column in the sample data above.
Does anyone have any hints on how to solve this problem?
Thanks.
Part No Sub-Part No
p1 sp1a
p1 sp1b
p1 sp1c
sp1a s-sp1a1
sp1a s-sp1a2
sp1c s-sp1c
s-sp1a1 s-s-sp1a1a
s-sp1a1 s-s-sp1a1b
s-s-sp1a1b s-s-s-sp1a1a
s-s-s-sp1a1a
There is a main part number (sp1) that has 1 or more sub-part numbers. Each sub-part number may have 1 or more sub-part numbers of it's own. So there is a grandparent-parent-child etc relationship that may be many levels deep. I do no know how many levels there are for any of the parts or subparts.
This process will be passed the main part number (p1). I need to write a stored procedure that will return all of the related part numbers such as the "part no" column in the sample data above.
Does anyone have any hints on how to solve this problem?
Thanks.