Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT c.Name AS "Kategoria", p.Name AS "Produkt", YEAR(sod.ModifiedDate) AS "Rok", SUM(sod.UnitPriceDiscount*sod.UnitPrice) AS "Kwota"
- FROM AdventureWorks2017.Sales.SalesOrderDetail AS sod JOIN AdventureWorks2017.Production.Product AS p ON sod.ProductID=p.ProductID JOIN AdventureWorks2017.Production.ProductSubcategory AS ps ON p.ProductSubcategoryID=ps.ProductSubcategoryID JOIN AdventureWorks2017.Production.ProductCategory AS c ON ps.ProductCategoryID=c.ProductCategoryID
- GROUP BY ROLLUP(c.Name, p.Name, YEAR(sod.ModifiedDate));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement