1-- In addition to the regular aggregation results we expect from the
2-- GROUP BY clause, the ROLLUP extension produces group subtotals from
3-- right to left and a grand total. If "n" is the number of
4-- columns listed in the ROLLUP, there will be n+1 levels of subtotals.
5
6SELECT fact_1_id,
7 fact_2_id,
8 fact_3_id,
9 SUM(sales_value) AS sales_value
10FROM dimension_tab
11GROUP BY ROLLUP (fact_1_id, fact_2_id, fact_3_id)
12ORDER BY fact_1_id, fact_2_id, fact_3_id;
13
14
15
16
17
18
19
20