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
 General SQL Server Forums
 New to SQL Server Programming
 Indented BOM

Author  Topic 

Vack
Aged Yak Warrior

530 Posts

Posted - 2014-05-15 : 12:05:34

Wondering if there is a way to run a script to list a Bill of Material.
that could be up to 11 levels deep

In the table below I have Parent item ABC with two components ZYX and VUW and Component ZYX also has two components TTT and XXX.




Parent_Item Seq Comp_Item Qty
ABC 10 ZYX 3
ABC 20 VUW 5
ZYX 10 TTT 2
ZYX 20 XXX 2

In a table similar to the one above with thousands of records. Is there a way to Query Parent item ABC and get these records returned in this order?



Parent_item Seq Comp_item Qty
ABC 10 ZYX 3
ZYX 10 TTT 2
ZYX 20 XXX 2
ABC 20 VUW 5

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-05-15 : 12:34:45
What is the logic behind the sorting? I see Seq would be first but not clear if it's Comp_item DESC next.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

Vack
Aged Yak Warrior

530 Posts

Posted - 2014-05-15 : 14:07:49
Sequence only
Go to Top of Page
   

- Advertisement -