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: