Created
January 27, 2016 08:02
-
-
Save dnasca/2c15be244c3810ac06af to your computer and use it in GitHub Desktop.
Applying predicates to a group
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
-- applying predicates to a group | |
SELECT | |
SOD.ProductID, | |
SOD.SpecialOfferID, | |
SUM(SOD.OrderQty) AS OrderQtyByProductId | |
FROM | |
Sales.SalesOrderDetail AS SOD | |
GROUP BY | |
SOD.ProductID, | |
SOD.SpecialOfferID | |
HAVING SUM(SOD.OrderQty) >= 100 | |
ORDER BY | |
SOD.ProductID, | |
SOD.SpecialOfferID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment