2 Replies - 303 Views - Last Post: 21 May 2018 - 08:13 AM

#1 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2882
  • View blog
  • Posts: 11,268
  • Joined: 03-December 12

Ranking sort of

Posted 21 May 2018 - 07:33 AM

I am raking my brain to figure out a ranking structure for a leaderboard project.

So, the maximum points available for the round is 10. Members that tie are awarded the same point value, down to 0.

For instance,
Member | Points
Tom | 10
Dick | 9
Harry | 9
Steve | 7


When there is a tie, the next value down would be awarded to the person below to limit total points to only 10.

I tried playing with the query in code to assign the points, but it is quite convoluted. Worked on doing a SQL rank, but it doesn't do ties well.

Anyone done a similar plan? Maybe go with a sp or a trigger that will update a table for the rankings instead?

Is This A Good Question/Topic? 0
  • +

Replies To: Ranking sort of

#2 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6798
  • View blog
  • Posts: 28,102
  • Joined: 12-December 12

Re: Ranking sort of

Posted 21 May 2018 - 07:42 AM

"to limit total points to only 10" I am slightly confused. Do you mean the maximum points awarded are 10, as the sample data suggests this rather than total points adding to 10 being distributed.

"Worked on doing a SQL rank, but it doesn't do ties well. " It sounds to me like exploring the difference between rank and dense-rank, in-part discussed here at SO.

Even if rank/dense ranking isn't the exact solution I would guess that it would be step 1, with values subsequently adjusted according to leaderboard rules.
Was This Post Helpful? 1
  • +
  • -

#3 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2882
  • View blog
  • Posts: 11,268
  • Joined: 03-December 12

Re: Ranking sort of

Posted 21 May 2018 - 08:13 AM

Much appreciated. I will have to tinker more with the query. The scheme is not normalized with helps and hurts the issue.


And yes. 10 points max down to 0 for the 11th ranked person.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1