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 |
|
SamC
White Water Yakist
3467 Posts |
Posted - 2002-06-09 : 21:28:56
|
| I want to get a count of all users, and "completed" users by office.select office, count(*) as total from users group by officeGives me total users by office.SELECT Office, COUNT(*) AS total FROM UsersWHERE (Completed = 1)GROUP BY OfficeGive me the count of users by office who have completed.Is there a single statement that'll give me both or do I need to join these two statements?Thanks,Sam |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-06-09 : 21:49:18
|
| SELECT Office, Sum(CASE Completed WHEN 1 THEN 1 ELSE 0 END) AS Completed, Count(*) AS TotalFROM UsersGROUP BY Office |
 |
|
|
|
|
|