A few days ago I posted a question which someone did reply to. However, the tables have been re-arranged a bit and I didn't want to make my last thread confusing, so I thought I'd start fresh here. (Mod, you may close down my other thread; thanks).
So I have 2 tables.
Table 1 field details: managerID, managerUsername, managerLastName, managerFirstName
Table 2 field details: managerID, mappedEmployeeID
Table 1 lists all the managers with a few details. Table 2 contains data which maps employees to managers.
What I want is a list of managers (their IDs, last_name + ', ' + first_name as full_name) without repeats (manager X shouldn't appear more than once!) AND the NUMBER of employees that are mapped to a manager.
If I was getting normal data, the query would go something like this:
SELECT * FROM dbo.tblManagers a INNER JOIN dbo.tblManagerAndEmployeeMappings b ON b.managerID = a.managerID ORDER BY a.managerID
However, I want the sum of the number of employees that belong to each manager as well as the manager details. Hope I explained this properly. Feel free to ask me to clarify anything. I appreciate the help! (sknake thanks for replying in my other thread, hopefully you can help me here).