I want to calculate SumofWorkingHours as below which is based in empID. e.g. if EmpID is 1 then it sum the working hours in every Admincode and display sum in all rows where EmpID exist.
Please give suggestion or query regarding this.
LoginName EmpID Practice AdminCode WorkingHours SumofWorkingHours E1 1 Admin IT 5.24 38.81 E1 1 Admin Finance 0.07 38.81 E1 1 Admin HR 33.50 38.81 E2 2 Admin Support 8.00 40.50 E2 2 Admin HR 32.50 40.50 E3 3 Admin Finance 5.50 45.08 E3 3 Admin Support 39.58 45.08
This data is only for testing
Looks like you just want to sum over EmpId, like this:
To integrate that into a larger query to specifically return the result set that you show in your question, you could do something like: