Skip to content
Advertisement

SQL RANK but higher if equal?

For data:

If I use RANK I get

if I use DENSE_RANK I get

I need for my application this:

Advertisement

Answer

I think you want:

Actually this would be simpler phrased with just a window count:

Demo on DB Fiddle:

val | rn
--: | -:
 20 |  1
 50 |  3
 50 |  3
 60 |  4
 70 |  5
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement