• L' Eomot Inversé (6/1/2013)


    (in this case watching the pattern of NULLs is a better way of identifying groups than using the badly chosen grouping id)

    True, but only in this case. If the base data has NULL values, you do need to use GROUPING_ID to differentiate a NULL from the base data from a NULL that represents aggregation for that particular column.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/