You can use the COUNT() function to return the number of records that match a query. The following 'Employee' table contains employee ID numbers and their associated manager's ID number.
A COUNT() statement can be used to find out how many employees have a specific manager:
SELECT COUNT(*) AS CNT FROM Employees WHERE Employee.Manager_ID = 37;
The function can also be combined in more complicated queries. To find out how many employees are directly supervised by a specified person, the following can be applied:
SELECT T1.Employee_ID, (SELECT COUNT(*) AS CNT FROM Employees AS T2 WHERE T2.Manager_ID = T1.Employee_ID) AS Supervised_Count FROM Employees AS T1;
MSDN documentation may be found here.