Created
October 11, 2019 19:58
-
-
Save gsampath127/2cd88e19590021cf4717835805350cf5 to your computer and use it in GitHub Desktop.
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 ProductName, | |
TotalAmout, | |
sum([TotalAmout]) OVER(ORDER BY ProductName) AS RunningTotal | |
FROM | |
(SELECT prod.ProductName, | |
sum(ord.Quantity*ord.UnitPrice) [TotalAmout] | |
FROM [Order Details] ord | |
INNER JOIN Products prod ON ord.ProductID=prod.ProductID | |
GROUP BY prod.ProductName) p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment