In MySQL, the GROUPING()
function allows us to identity which rows have been generated by the WITH ROLLUP
modifier of the GROUP BY
clause.
By default, WITH ROLLUP
outputs NULL
as the value that represents all aggregate values. By this, I mean it doesn’t provide us with a nice easy to read label. It simply outputs NULL
. This makes it more difficult for us to distinguish between normal rows and super aggregate rows that were generated by WITH ROLLUP
.