grouping sets && grouping_id

来源:互联网 发布:golang并发和java对比 编辑:程序博客网 时间:2024/05/16 17:10
select sex,age,mobile_type,COUNT(1) num,grouping_id(sex,age,mobile_type)  from per_rain..sht1126
group by
grouping sets
(
(),
(sex),
(sex,age,mobile_type)
)
order by grouping_id(sex,age,mobile_type) desc