Created
January 9, 2017 16:42
-
-
Save chadsten/2549e50bc34d49340f932d105f368b5b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 TOP (100) PERCENT PartNum, CONVERT(DECIMAL(16, 4), CEILING(SUM(OurShipQty) * 2)) AS YearTotal, CONVERT(DECIMAL(16, 4), CEILING(SUM(OurShipQty) / 6)) | |
AS MonthAvg, COUNT(PartNum) AS Hits | |
FROM dbo.v_InvoiceRegisterForTurns | |
WHERE (InvoiceDate > DATEADD(month, - 6, GETDATE())) AND (Plant = 'DIST') AND (InvoiceTerms NOT IN ('16', '26', '14', 'PORD', '50%D', '50%S')) AND (BuyToOrder = 'false' OR | |
BuyToOrder IS NULL) | |
GROUP BY PartNum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment