Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SUMMING THE HOURS BY PROJECT, EMPLOYEE

Status
Not open for further replies.

lilal111

Technical User
Sep 16, 2008
18
0
0
CA
I am trying to create a procedure in sql server 2008 that summarizes the hours by employee and project in one line from the following. For Example adding all the hours for project 1913 by employee in one line to say and so on. I would appreciate any help with this.

Thanks!!

project hrs emplid
1913 16.93 184

project hrs emplid
1916 xxx 184

project hrs employee id
1913 3.75 184
1913 3.58 184
1913 3.75 184
1913 3.83 184
1913 0.02 184
1913 2.25 184

project hrs emplid
1916 8 184
1916 8 184
1916 8 184
1916 8 184
1916 8.25 184
1916 2 184
1916 3 184
1916 1 184
 
Code:
Select Project, Sum(hrs) As TotalHours, emplid
From   YourTableName
Group BY Project, emplid


-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Thank you so much. I was stumbling on the context of the sql statement. I really appreciate it!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top