1.grouping sets grouping sets子句都可以根据UNION连接的多个GROUP BY查询进行逻辑表示 SELECT a,b,SUM(c)FROM tab1 GROUP BY a,b GROUPING SETS((a,b),a,b,()) 等价于 SELECT a,b,SUM(c)FROM tab1 GROUP BY a,b union SELECT a,null,SUM(c)FROM tab1 GROUP BY a,null union SELECT null,b,SUM