Select pc.ParentItem, pc.ComponentItem as 'Component1', pc.QtyPer as 'QtyPer1'
, pc1.ComponentItem as 'Component2', pc1.QtyPer as 'QtyPer2'
, pc2.ComponentItem as 'Component3', pc2.QtyPer as 'QtyPer3'
, pc3.ComponentItem as 'Component4', pc3.QtyPer as 'QtyPer4'
, pc4.ComponentItem as 'Component5', pc4.QtyPer as 'QtyPer5'
From ParentChild pc
Left Join ParentChild pc1 on pc.ComponentItem = pc1.ParentItem
Left Join ParentChild pc2 on pc1.ComponentItem = pc2.ParentItem
Left Join ParentChild pc3 on pc2.ComponentItem = pc3.ParentItem
Left Join ParentChild pc4 on pc3.ComponentItem = pc4.ParentItem
WHERE pc.ParentItem = '2010STD8FT-17'
Order by pc.ParentItem
, pc.ComponentItem
, pc1.ComponentItem
, pc2.ComponentItem
, pc3.ComponentItem
, pc4.ComponentItem
|