Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
yidrasil
Starting Member
21 Posts |
Posted - 2011-07-07 : 04:26:12
|
| Folks,I haven't managed to find quite the same request as this after searching sh here goes....I have a table with columns 'Name' and 'Timeatwork'The former contains distinct names (no same name cases) the latter values represent hours. I am looking to count hours related to each individual so I may have, for example;John Smith 10Simon Jones 3John Smith 20Simon Jones 6Alan James 50So, looking for an end result ofJohn Smith 30Simon Jones 9Alan James 50Note that this query runs once daily so will add new names and values on a daily basis. Note also the names are not known in advance.Have tried summing and grouping but so far unsuccessfully.Would really appreciate some expert help...Many thanks,Yid |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-07-07 : 04:27:34
|
| select name, Timeatwork=sum(Timeatwork)from tblgroup by name==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
yidrasil
Starting Member
21 Posts |
Posted - 2011-07-10 : 17:32:24
|
| Thanks Nigel, just the job. Was over-thinking the issue.All the best,Yid |
 |
|
|
|
|
|