@PaulWhite Was there any specific reason for the
CASE
expression
CROSS APPLY
in CTE
C2
in
your answer here other than to give it an alias so it can be cleanly used in the
SUM()
window function for the
grp
column?...seems like moving the
CASE
expression directly inside the
SUM()
window function gives me the same results?