The joins to the InventTable in the common table expression are not necessary as long as your data is clean. However, using them will ensure that only valid product and material item numbers are included.