The title may be a little misguided but I am unsure of how to phrase it.
I am having an issue where I need to return the details of the manager with the most subordinates.
The table is currently set out like this for example.
I am currently running this query to find the {manager} and how many times the {manager} has been assigned to employees:
SELECT *, count(manager) AS managercount FROM employee GROUP BY manager ORDER BY managercountb DESC LIMIT 1;
Result: manager: 101 managercount: 4
I however need to find a way to display all of the details of the manager via the employeeid.
I have attempted entering 'WHERE manager = employeeid' which will return nothing since no employee is the manager of themself.
I need advice on how to include all of the columns based on the manager with the most employees under them.