GROUPING SETS (
( e1>, e2>, e3>, ... ),
...
- ( e1>, e2> )
- ( e1> )
+ ( e1>, e2> ),
+ ( e1> ),
( )
)
( b, c ),
( b ),
( c ),
- ( ),
+ ( )
)
units for the purposes of generating the individual grouping sets.
For example:
-CUBE ( (a,b), (c,d) )
+CUBE ( (a, b), (c, d) )
is equivalent to
GROUPING SETS (
- ( a, b, c, d )
- ( a, b )
- ( c, d )
+ ( a, b, c, d ),
+ ( a, b ),
+ ( c, d ),
( )
)
and
-ROLLUP ( a, (b,c), d )
+ROLLUP ( a, (b, c), d )
is equivalent to
GROUPING SETS (
- ( a, b, c, d )
- ( a, b, c )
- ( a )
+ ( a, b, c, d ),
+ ( a, b, c ),
+ ( a ),
( )
)
clause, then the final list of grouping sets is the cross product of the
individual items. For example:
-GROUP BY a, CUBE(b,c), GROUPING SETS ((d), (e))
+GROUP BY a, CUBE (b, c), GROUPING SETS ((d), (e))
is equivalent to
GROUP BY GROUPING SETS (
- (a,b,c,d), (a,b,c,e),
- (a,b,d), (a,b,e),
- (a,c,d), (a,c,e),
- (a,d), (a,e)
+ (a, b, c, d), (a, b, c, e),
+ (a, b, d), (a, b, e),
+ (a, c, d), (a, c, e),
+ (a, d), (a, e)
)
- The construct (a,b)> is normally recognized in expressions as
+ The construct (a, b)> is normally recognized in expressions as
a row constructor.
Within the GROUP BY> clause, this does not apply at the top
- levels of expressions, and (a,b)> is parsed as a list of
+ levels of expressions, and (a, b)> is parsed as a list of
expressions as described above. If for some reason you need>
- a row constructor in a grouping expression, use ROW(a,b)>.
+ a row constructor in a grouping expression, use ROW(a, b)>.