For more information related to the GROUP BY clause, see: How Teradata Database Resolves Multiple Grouping Sets Specifications CUBE Grouping Set Option GROUPING SETS Option ROLLUP Grouping Set Option ORDER BY Clause