Is there any way to implement group by grouping sets() like in oracle. I am writing queries that were previously implemented in oracle but I am not being able to find this feature in vertica. In oracle we can rewrite queries of the format
Code: Select all
SELECT a, b, SUM( c ) FROM t
GROUP BY GROUPING SETS ( ( a, b ), ( a ), ( b ), ( ) );
to
Code: Select all
SELECT a, b, SUM( c ) FROM t
GROUP BY a, b
UNION ALL
SELECT a, NULL, SUM( c ) FROM t
GROUP BY a
UNION ALL
SELECT NULL, b, SUM( c ) FROM t
GROUP BY b
UNION ALL
SELECT NULL, NULL, SUM( c ) FROM t;
Is there any way out to directly implement group by grouping sets in vertica avoiding multiple table scan...?? like in above example..please help