Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.52 KB | None | 0 0
  1. SELECT c.Name AS "Kategoria", p.Name AS "Produkt", YEAR(sod.ModifiedDate) AS "Rok", SUM(sod.UnitPriceDiscount*sod.UnitPrice) AS "Kwota"
  2. 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
  3. GROUP BY ROLLUP(c.Name, p.Name, YEAR(sod.ModifiedDate));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement