Archives of the TeradataForum
Message Posted: Tue, 23 Feb 2010 @ 14:48:16 GMT
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 ?
|Copyright 2016 - All Rights Reserved
|Last Modified: 15 Jun 2023