Mysql中有一个with rollup是用来在分组统计数据的基础上再进行统计汇总,即用来得到group by的汇总信息;
表中数据有:
没有with rollup的查询
select count(*),age from age group by age;
结果:
有with rollup的查询语句:
select count(*),age from age group by age with ROLLUP;
结果:
Mysql中有一个with rollup是用来在分组统计数据的基础上再进行统计汇总,即用来得到group by的汇总信息;
表中数据有:
没有with rollup的查询
select count(*),age from age group by age;
结果:
有with rollup的查询语句:
select count(*),age from age group by age with ROLLUP;
结果: