Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Tue, 23 Feb 2010 @ 14:48:16 GMT

  <Prev Next>  
Next> Last>>  

Subj:   RANK Function query
From:   Raste, Tushar


I have a query about RANK function :

I was reading the Teradata manual which mentions the following about RANK function :

Meaning of Rank

A rank r implies the existence of exactly r-1 rows with sort_expression value preceding it. All rows having the same sort_expression value are assigned the same rank.

For example, if n rows have the same sort_expression values, then they are assigned the same rank call it rank r. The next distinct value receives rank r+n.

Less formally, RANK sorts a result set and identifies the numeric rank of each row in the result. The only argument for RANK is the sort column or columns, and the function returns an integer that represents the rank of each row in the result.

Now the question I have is that lets say if we have 3 rows where 2 rows have the same rank , lets say 1, then the next row will have rank 3. Is there any way in which we can ensure that the next row will have rank 2 ?


Tushar Raste

  <Prev Next>  
Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023