Answer the question
In order to leave comments, you need to log in
How to get the row number in the selection and the slice of the selection around this row?
There is a users table with id and points fields, points is of double type.
How, knowing the user id, to get the line number with this user in the selection sorted by points?
That is, it will be the user's place in the ranking.
And how to get 5 users before and 5 users after this user in the rating?
Answer the question
In order to leave comments, you need to log in
select * from tbl order by user.rating - :target
union
select * from tbl order by :target - user.rating
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question