嗨,我想问一些关于我的工作的事情
select * from
(Select m.Brand,u.Color,Count(Unit)as [Total unit]
from Brands m
inner join Products u on m.BrandID=u.ProductID
Group by m.Brand ,u.Color
with cube
)as Pvt
PIVOT ( Sum([total unit])
For Color IN ( [Black],[White],[Gray],[Silver],[Orange],[Dark Blue] )
)AS Pivot_Table
我想显示总品牌和总颜色,但这段代码只计算每种颜色并计算每个品牌的每种颜色
我如何获得 Total Brand 和 Total Color ?