我有两个表。排名函数总和
abc(CID(pk), cname,)
order(order_id(pk), CID(fk), number_of_rentals)
我想根据他们租用的电影数量来确定前10名客户。
select
orders.cid,orders.no_rentals, abc.name,
rank() over (order by no_rentals desc) "rank"
from abc
inner join orders on orders.CID = abc.CID;
我用这个查询,但它不是通用的。如何使用此查询在number_of_rentals上使用sum函数?
的可能的复制[甲骨文SELECT TOP 10记录](http://stackoverflow.com/questions/2498035/oracle-select-top-10-records) – MT0