我需要选择最高薪水的前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;
你似乎想要这样的东西:
select e.*
from employees e
order by e.salary desc
fetch first 3 rows only;
这将选择薪水最高的三名员工。并非所有数据库都支持ANSI标准FETCH FIRST
子句。您可能需要使用LIMIT 3
,SELECT TOP 3
或其他东西。