Skip to content

Instantly share code, notes, and snippets.

@JoshZastrow
Last active March 21, 2017 19:51
Show Gist options
  • Save JoshZastrow/6c64683d840f4b43e91358aa1ae0a7fd to your computer and use it in GitHub Desktop.
Save JoshZastrow/6c64683d840f4b43e91358aa1ae0a7fd to your computer and use it in GitHub Desktop.
EPICOR Parts: total due this year against bar yield qty
SELECT
O.PartNum,
SUM(O.OurReqQty) AS [2017 Total Due],
ROUND(12/ PartMtl.QtyPer,0) [Bar Yield Qty]
FROM ERP10PROD.Erp.OrderRel O
LEFT JOIN ERP10PROD.Erp.PartMtl PartMtl ON
O.Company = PartMtl.Company AND
O.PartNum = PartMtl.PartNum AND
O.RevisionNum = PartMtl.RevisionNum
WHERE PartMtl.UOMCode = 'FT'
AND O.ReqDate < '20170921'
GROUP BY O.PartNum, PartMtl.QtyPer
HAVING SUM(O.OurReqQty) < 12/PartMtl.QtyPer
ORDER BY O.PartNum ASC
@JoshZastrow
Copy link
Author

Combines previous two gists -- For part numbers with releases before End Of Year and have material quantity by foot, return total parts due and bar quantity amounts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment