Last active
March 21, 2017 19:51
-
-
Save JoshZastrow/6c64683d840f4b43e91358aa1ae0a7fd to your computer and use it in GitHub Desktop.
EPICOR Parts: total due this year against bar yield qty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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