2

I have a table similar to the following:

employee_id | totalWorkHours | projectID
     1             20              123
     1             20              321

     2             15              222
     2             25              333

     3             10              434
     3             12              343

Is it possible to combine rows based on employee_id, but add totalWorkHours into an actual total for an employee and present in a result set without modifying the table?

So the results would be something like:

employee_id | actualTotalWorkHours
     1                 40
     2                 40              
     3                 22

Or is this something better done with the raw result set?

Any help is much appreciated.

1 Answer 1

2
Select employee_id, Sum(totalWorkHours) As actualWorkHours
From   YourTableName
Group By employee_id
Order By employee_id
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.