CREATE TABLE #Product (ProductId INT, ProductName Varchar(500), Price MONEY)
INSERT INTO #Product (ProductId ,ProductName,Price)
VALUES(1, 'Test1', 12000),
(2, 'Test2', 18000),
(3, 'Test3', 25000),
(4, 'Test4', 15000),
(1, 'Test4', 15000)
SELECT ProductId ,ProductName, SUM(Price) AS Price
FROM #Product Group By
GROUPING SETS((ProductId), (ProductName),())
SELECT ProductId ,ProductName, SUM(Price) AS Price
FROM #Product Group By
GROUPING SETS((ProductId, ProductName),())
這兩個有什麼不同?以及在哪裏使用第一個和第二個分組集的差異