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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COUNT function 1

Status
Not open for further replies.

krets

Technical User
Dec 29, 2006
214
US
I have a table of employees and in that table there is a field named "Function" that designates the employee as a pharmacist or technician. What my managers would like to do is be able to quickly view the ratio of pharmacists to technicians for board of pharmacy compliance purposes.

To count each one I've done:

SELECT COUNT (EmployeeId) FROM EmployeeTable WHERE Location = "Kansas" AND Function = "Pharmacist";

SELECT COUNT (EmployeeId) FROM EmployeeTable WHERE Location = "Kansas" AND Function = "Technician";

Is there a way to combine these into one query? Or possibly a better way to designate their job functions?
 
How about:
Code:
SELECT Function, COUNT (EmployeeId) FROM EmployeeTable WHERE Location = "Kansas" GROUP BY Function;
That should give you a count for each function within the same query.

Hope this helps

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Ahhh, perfect! Star for you!
 
Glad I could help [smile]

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top