我有一个“缺少表达”的错误,我无法找出原因。那里有代码

问题描述 投票:0回答:1

我需要选择最高薪水的前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;
sql count expression
1个回答
2
投票

你似乎想要这样的东西:

select e.*
from employees e
order by e.salary desc
fetch first 3 rows only;

这将选择薪水最高的三名员工。并非所有数据库都支持ANSI标准FETCH FIRST子句。您可能需要使用LIMIT 3SELECT TOP 3或其他东西。

© www.soinside.com 2019 - 2024. All rights reserved.