Rank for values in table

alonsql

New member
Rank for values in table

Hi guys,

I'm trying to write a select query that ranks the values in a table.
I'd appreciate your help with this.

Example values:

Name | Age
Bob | 15
Ron | 4
John | 29
Mike | 4
Joe | 2

The select result I'm looking to get is (sorted largest to smallest):

Rank | Name | Age
1 |John | 29
2 |Bob | 15
3 |Ron | 4
3 |Mike | 4
4 |Joe | 2

*The duplicate values should be able to share a rank like in the example above.
 

pitoach

New member
אותו דבר אבל עם DENSE_RANK

DENSE_RANK לא משאיר רווחים במיספור בעוד RANK משאיר רווחים במספור ולכן אם היו 4 פעמים מיספור X אז המספור הבא לא יהיה X+! אלא X+4
 

גרי רשף

New member


 
למעלה