我试图展示收入至少是其主管收入的 25% 的员工。到目前为止,我有一个可以显示主管本身的子查询代码,但我不确定如何“获取”主管工资:
SELECT TOP (100) PERCENT firstname + ' ' + lastname AS Employee,
id,
jobtitle AS [Job Title],
Str(Round(salary / 12, 2), 12, 2) AS [Monthly Salary]
FROM employeetable
WHERE ( id IN (SELECT supervisor
FROM employeetable
WHERE ( supervisor IS NOT NULL )) )
ORDER BY lastname,
firstname