jeudi 21 juillet 2016

How to Select Count for every user within a table

I have a Table named "Calls". The table's columns are organized as

CallCounter, AssignedEmpID, CompletedByEmpID
1            200            200
2            200            200
3            201            200
4            200            200
5            201            201
6            201            200
7            200            200
8            200            200
9            200            201
10           201            201
...

How do I create a Select SQL query that will return the following data. Ideally I would like to complete the entire SQL query in 1 query.

Employee    # Calls Assigned    # Calls Completed
200         6                   7
201         4                   3

I have tried the following queries

SELECT AssignedEmpID, COUNT(CallCounter) FROM CALLS
SELECT COUNT(*) FROM Calls

Aucun commentaire:

Enregistrer un commentaire