DEV Community

Cover image for Multi-level Aggregation Using MySQL GROUP BY WITH ROLLUP - OpenLampTech Repost
Joshua Otwell
Joshua Otwell

Posted on

Multi-level Aggregation Using MySQL GROUP BY WITH ROLLUP - OpenLampTech Repost

A means to retrieve multi-level aggregation metrics in a single query...


Call it premonition or just my curiosity, but for whatever reason, I have been studying - of my own accord - the WITH ROLLUP modifier for the MySQL GROUP BY clause.

Having never used WITH ROLLUP in any queries in real-world projects, I still found it quite interesting as a means to retrieve multi-level aggregation metrics in a single query.

And so, some amount of time passedā€¦

Lo and behold I would need this functionality sooner than I anticipated for a query requirement so kudos to my curious persistence!

Nevertheless, what does GROUP BY WITH ROLLUP do?

That is what we are going to learn about in this post using some simple exploratory queries and examples.

Read the entire article over in the OpenLampTech publication...

Top comments (0)