SQL: UNION ALL, ROLLUP and GROUPING SETS for sub-totals

Опубликовано: 10 Март 2026
на канале: flexyourdata
1,155
30

Walkthrough of a case study of a building a SQL report with very specific requirements.

We look at how to add sub-totals to a query using UNION ALL and talk about why this is not usually a good idea.

We then look at how to achieve the same result with the ROLLUP function.

Finally, we talk briefly about getting to the same place with GROUPING SETS.

#sql #coding #rollup #groupingsets #unionall