[MYSQL]:使用 SELECT 语句查询存在于同一 Table 的另一列中的唯一键的出现

[MYSQL]: Using SELECT statements to query occurrences of a unique key that exist in another column in the same Table

我要查的是员工id,主管的工资,以及他们每个人直接主管的员工总数。

我有以下员工Table:

我是 mysql 的新手,目前被这个问题困住了。

为此工作使用别名 使用您的参数尝试此查询

select employee_id, 工资, job_title, (select count(*) from table where supervisor_id = short_name1.employee_id) as total_team from table as short_name1 where job_title = "supervisor"