Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

How to not to skip a RANK ? - response (2) by KS42982

$
0
0
I don't think that will work because users want top 100 rank values. But for them ranking means not like teradata ranking. They don't want to skip a rank. With row_number, I will get unique number count, but how to identify what are top 100. For example, as per RANK and ROW_NUMBER we will get output like below -   Store Item Sales Rank  Row Number 1 A 100 1 1 1 B 100 1 2 1 C 99.99 3 3 1 D 99.98 4 4 1 E 90 5 5 1 F 90 5 6 1 G 85 7 7 1 . . . . 1 . . . . 1 . . . . 1 XXX 50 100 100 But they want like -   Store Item Sales Rank  1 A 100 1 1 B 100 1 1 C 99.99 2 1 D 99.98 3 1 E 90 4 1 F 90 4 1 G 85 5 1 . . . 1 . . . 1 . . . 1 XXX 50 80 1 . . . 1 . . . 1 . . . 1 ZZZ 20 100 So not sure, how do I go till item = zzz (and not stop at xxx) to get the required results.  

Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>