Table2
@ChangeNumber
INNER JOIN [StructureItem_View] SI ON SI.ParentItem=R.ItemId
AND SI.[FromNum] <= @ChangeNumber AND SI.[ToNum] > @ChangeNumber
INNER JOIN viewer.ItemMasterView ChldItm ON ChldItm.ItemId = SI.BasicItem
LEFT JOIN BusinessObject_View SIUoM ON SIUoM.[Id] = SI.[UoM]
WHERE
R.Id = @P1
ORDER BY
PrntItm.Number, SI.Number
]]>