grouping sets 的使用

it2026-04-06  9

grouping sets 可以用于在计算分组聚合函数值的同时计算合计值

-- 查询结果group_id为NULL的那一行即为合计值 select group_id , count(distinct user_id) as user_num from table_name group by group_id grouping sets ((group_id),())

 

参考资料:

https://blog.csdn.net/u013053796/article/details/18620631

https://www.cnblogs.com/ToDoToTry/p/5474231.html

Hive分析窗口函数:http://lxw1234.com/archives/2015/04/193.htm

转载于:https://www.cnblogs.com/shujuxiong/p/9506003.html

最新回复(0)