select * from (select sum(dpt_no) as numbers from department group by dpt_name) order by numbers desc
结果:
NUMBERS
----------
420
209
106
105
103
102
如何给这个结果排名?
答案 0 :(得分:2)
请尝试:
select
numbers,
rank() over(order by numbers desc) Rank
from (
select sum(dpt_no) as numbers
from department group by dpt_name
)
order by numbers desc
样品:
select
Col,
rank() over(order by Col desc) Rank
From YourTable