TIA 提供任何帮助/建议/进一步阅读。
我试图让 SQLDev 计算客户拥有多少包,然后只显示这些结果中的前 10 个。
所以我有这个....
select pickup_customer , count (pickup_customer)
from
( select pickup_customer, count (pickup_customer)
from manifest
order by count (pickup_customer) desc )
where ROWNUM <= 10
group by pickup_customer
order by count (pickup_customer) desc
有了这个,我得到“不是一个单一的组功能”,我不知道哪里出了问题。可能非常简单的修复,我现在看不到它!
编辑:我已经尝试过这段代码,但现在出现“缺少右括号”错误!
select pickup_customer , count (pickup_customer)
from
(select pickup_customer, count (pickup_customer) --sub-query which pre-orders the results for rownum to then limit.
from manifest
order by count (pickup_customer) desc
group by pickup_customer)
where ROWNUM <= 10 -- limits the results to be only the top 10