Answer the question
In order to leave comments, you need to log in
How to sort the rating table?
Hello everyone, there was a task to make a user rating. There is a separate table with user ids and their "points" - score. Periodically (presumably 2-3 times per minute) this table will change 2-5 positions at a time. Quite often it is necessary to output a given rating sorted by score. How to work with this rating?
So far, I see 2 options:
1) It's trite to sort through sql queries with each request to display the rating (there are some doubts about what should be done with positions that have the same number of points).
2) Add a column with positions in the rating. With each change in points in the rating, carry out either a complete sorting or sorting in the area where the rating changes (if the user jumps, say, 50 positions up, then the rating will change for these 50 positions).
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question