我需要选择前3个employees
最高薪水,我会在at line 4 column 14
函数后面得到错误count()
。有人可以开导我吗?
select last_name
from employees
group by salary
having count(select max(salary) from employees group by salary)=3
order by salary desc;
答案 0 :(得分:2)
你似乎想要这样的东西:
select e.*
from employees e
order by e.salary desc
fetch first 3 rows only;
这将选择薪水最高的三名员工。并非所有数据库都支持ANSI标准FETCH FIRST
子句。您可能需要使用LIMIT 3
,SELECT TOP 3
或其他内容。