Hello mrbear,
What "r123456" is trying to convey is that you should perform the top N analysis. in which what is done is that suppose you want to get the Top five ranked values. the top values can change according to the scenario. suppose you want to get the top 5 hit singles orr movies. Now these rankings are done so that the top five movies will be ranked as
1,2,3,4,5 .... but if you want to get the top 5 highest price of an item then you will first have to sort the output in Descending order and then pick the top five values.
In the query mentioned by "r123456"
Select columns from
(select columns, RANK() OVER (ORDER BY column DESC) RN from tableA ) V
where V.RN <= 5;
The RN is the RowNum, it is a pseudocolumn and acts like a serial number, so what it is doing is that it is first sorting the table into the Descending order and then it is picking up the top 5 rows.
Hope this helps.
Take care
Saqib...