看来看去还是不知道这两个的区别,用AdventureWorks示例数据库
SELECT i.Shelf,
p.Name,
SUM(i.Quantity) Total
FROM Production.ProductInventory i
INNER JOIN Production.Product p ON
i.ProductID = p.ProductID
GROUP BY i.Shelf, p.Name
WITH ROLLUP
SELECT i.Shelf,
p.Name,
SUM(i.Quantity) Total
FROM Production.ProductInventory i
INNER JOIN Production.Product p ON
i.ProductID = p.ProductID
GROUP BY i.Shelf, p.Name
WITH CUBE
看起来查询结果没有什么区别,谁能给我讲讲这两个的区别?