I need to calculate the respective rank of a series of returned data, but not sure how to easily deal with ties. My database query returns teamid and points in descending order of points. This is easy to get the order, with team one having the most points, team two the second, etc. But what when the teams tie?
If two or more teams have the same points, they should have the same rank. For example, If team1 has 35 pts, team2 has 42 pts and team3 and team4 have 38, their ranking should be team2 (rank 1), team3 (rank 2), team4 (rank 2), team1 (rank3).
Do I loop through them and not increment the ranking variable if they have the same points as the previous team? (The possibility I'm thinking of...)
Is there a better or easier way? I just can't seem to wrap my brain cells around this one today. 😕 Any advice?