Reputation: 1546
I have a set of data
alex, 50
anu, 85
limi, 41
sam, 56
I need to find the rank of the students and store it in another column with the rank eg:-
alex 50 3
anu 85 1
limi 41 4
sam 56 2
I tried with the rank function.
SELECT
a.name, a.mark,
rank() over (ORDER BY a.mark DESC) as rank
FROM
list a;
Upvotes: 0
Views: 1143
Reputation: 294287
About Window and Analytic functions in HIVE. They were introduced in HIVE 0.11, see HIVE-896. You can read the specification in the Hive Language Manual, including examples.
Make sure you run on Hive 0.11 to start with.
Upvotes: 1