I use a MySQL database to store scores for my game. A very simplified version of the table will be
(PlayerID - int) (Name - string) (Score - int)
I would like to form a query that will return me a set of 10 results, in which the player of interest is in the middle of the table.
Perhaps an example will make it more understandable.
I just got a high score, my name is Steve. When I look at the table of high scores, I would like to see 5 points below me and 5 points above me. Obviously, if I have a top score, I will see 9 points below me, and vice versa, if I am below, I will see 9 points above me. The scorecard may consist of thousands of points.
Since the database is specifically designed for querying datasets, I would like to reduce the amount of post-processing of the results.
Does anyone have any ideas for a request?
Thanks rich
source
share