grouping functions sql code example
Example 1: grouping sql
SELECT SalesQuota, SUM(SalesYTD) 'TotalSalesYTD', GROUPING(SalesQuota) AS 'Grouping'
FROM Sales.SalesPerson
GROUP BY SalesQuota WITH ROLLUP;
GO
Example 2: group functions in sql
Multiple Row Functions (Group functions, Aggregate functions):
(Count, MIN , MAX, AVG, SUM)
will run for multiple rows and return a single value