|
|
Archives of the TeradataForum
Message Posted: Tue, 28 Aug 2007 @ 11:36:26 GMT
Subj: | | Re: Rank in Teradata |
|
From: | | D silva, Joseph Vinish |
| I have a report with two columns - Id and Volume. | |
| Now I want to rank Top 5 Id based on the Volume. I know it is easy to do. But the problem is I want to Rank them before pulling all the
data in the report. | |
Are you looking for something like QUALIFY ?
SELECT ID, VOLUME, RANK() OVER(ORDER BY VOLUME) RNK
FROM MyTable
QUALIFY RNK <= 5
;
ID VOLUME RNK
500777055 0.01 1
700009148 0.02 2
500854807 0.03 3
131734 0.04 4
503282204 0.04 4
Joseph D'silva
| |