Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Order of RANK(yy) - forum topic by PeterSchwennesen

$
0
0

I am a little confused about the suntax of the RANK() function.
I thought that the proper syntax was: RANK() OVER (PARTITION BY xx ORDER BY yy)
But I found that you can write: RANK(YY).
But RANK(yy) and RANK() OVER (ORDER BY yy) order opposite. If I have input yy = 1,2,2,3 then RANK(yy) gives 1=4,2=2 and 3=1, but RANK() OVER (ORDER BY yy) gives 1=1, 2=2 and 3=4.
RANK(yy) order DESC as default, but RANK() OVER (ORDER BY yy) order ASC as default. To have RANK(yy) order ASC I have to write RANK(yy ASC). I do not understand why the RANK(yy) has opposite default than the ORDER by version?
Peter Schwennesen

Tags: 
Forums: 

Viewing all articles
Browse latest Browse all 14773

Trending Articles



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