SQL Training: Rollup and Cube(OLAP/SSAS)
--Rollup
select st.[Group],st.[Name],st. CountryRegionCode,
sum(st.SalesYTD) current_year_sales,
sum(st.SalesLastYear ) last_year_sales
from AdventureWorks2012.Sales. SalesTerritory as st
Group by st.[Group],st.[Name],st. CountryRegionCode
with Rollup
--cube
select st.[Group],st.[Name],st. CountryRegionCode,
sum(st.SalesYTD) current_year_sales,
sum(st.SalesLastYear ) last_year_sales
from AdventureWorks2012.Sales. SalesTerritory as st
Group by st.[Group],st.[Name],st. CountryRegionCode
with cube
These two functions are comparable to OLAP transactions.
Comments
Post a Comment