Answers for "DO CUBE RETURN THE GRAND TOTAL"

SQL
0

cube oracle

-- the CUBE extension will generate subtotals for all combinations of the 
 -- dimensions specified. If "n" is the number of columns listed in the CUBE,
 -- there will be 2^n subtotal combinations.
 
 SELECT fact_1_id,
       fact_2_id,
       fact_3_id,
       SUM(sales_value) AS sales_value
FROM   dimension_tab
GROUP BY CUBE (fact_1_id, fact_2_id, fact_3_id)
ORDER BY fact_1_id, fact_2_id, fact_3_id;
Posted by: Guest on September-06-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language