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 |
|
kpgraci
Yak Posting Veteran
68 Posts |
Posted - 2011-01-12 : 17:20:03
|
| I have a table with:PersonNameDepartmentI want a result data set with a unique list of departments and the number of people in that department, for example:Sales 14Marketing 30Management 12I can't even begin to get going on this...what would the query be?kpg |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2011-01-12 : 17:32:33
|
Assuming that each combination of Department and PersonName is unique with only one entry in the table:select Department, count(*) as NumberOfPeoplefrom MyTablegroup by Departmentorder by Department CODO ERGO SUM |
 |
|
|
|
|
|