标签:
功能介绍:
自定义分组的字段
创建表:
插入测试数据:
Grouping Sets(null,t.classid,(t.classid,t.studentname)),类似于ROLLUP
Select t.classid,t.studentname,Sum(t.score) From Score t Group By Grouping Sets(null,t.classid,(t.classid,t.studentname));
查询结果:
Grouping Sets(null,t.classid,t.studentname,(t.classid,t.studentname)),类似于CUBE
Select t.classid,t.studentname,Sum(t.score) From Score t Group By Grouping Sets(null,t.classid,t.studentname,(t.classid,t.studentname));
查询结果:
标签:
原文地址:http://www.cnblogs.com/yuan-yuan/p/4600580.html