rollup and cube group by


##操作指令
ROLLUP (DATEPART(yyyy,OrderDate)
,DATEPART(mm,OrderDate)
,DATEPART(dd,OrderDate))

##分组结果集
year, month, day
year, month
year
()

操作指令

ROLLUP (region, city),
ROLLUP (DATEPART(yyyy,OrderDate)
    ,DATEPART(mm,OrderDate)
    ,DATEPART(dd,OrderDate))

分组结果集

region, city, year, month, day
region, city, year, month
region, city, year
region, city
region, year, month, day
region, year, month
region, year
region
year, month, day
year, month
year
()

操作指令

CUBE (region, city
    ,DATEPART(yyyy,OrderDate)
    ,DATEPART(mm,OrderDate)
    ,DATEPART(dd,OrderDate))

分组结果集

region, city, year, month, day
region, city, year, month
region, city, year
region, city
region, city, month, day
region, city, month
region, city, day
region, city, year, day
region, city, day
region, year, month, day
region, year, month
region, year
region, month, day
region, month
region, year, day
region, day
region
city, year, month, day
city, year, month
city, year
city, month, day
city, month
city, year, day
city, day
year, month, day
year, month
year
year, day
month, day
month
day
()

你可能感兴趣的:(rollup and cube group by)