This is a followup to this ticket.
My question is on the same table used in that ticket.
So one of the solutions mentioned in that ticket was this. Which worked fine. It grouped employees by EmployeeID
select case when rn = 1 then EmployeeID else '' end as EmployeeID
,[Region], [Company], [LastName], [FirstName], [MidInit], [HoursWorked], [TookTimeOff]
from ( select [Region], [Company], cast(employeeid as varchar(10)) as EmployeeID, [LastName], [FirstName], [MidInit], [HoursWorked], [TookTimeOff]
,row_number() over (partition by employeeid order by region,company,LastName,FirstName,HoursWorked) as rn
from TestEmployees2) as SDT
order by [LastName],[FirstName], RN
Now how do I add a total column for each employeeid that sums the total for the HoursWorked for each EmployeeID?
So my desired result should look like this drawing i sketched in excel. I basically want to add the Employee Total rows colored blue in this image.