CUBE() produces the result set by generating all combinations of columns specified in GROUP BY CUBE(). As with GROUP BY ROLLUP() it adds sub-total and grand-total rows as well.
For example, consider below data:
-- © 2011 – Vishal (http://SqlAndMe.com)
SELECT [Group], [Name], [S......