This has me stumped. This is quite a simplified version but let’s say I have a league table of users in SQL Server such as:
UserId Total
1 10
2 5
3 20
4 3
5 40
6 15
7 22
8 1
9 18
10 33
Now I can easily order this to be by total like so:
Position UserId Total
1 5 40
2 10 33
3 7 22
4 3 20
5 9 18
6 6 15
7 1 10
8 2 5
9 4 3
10 8 1
But I would also like to display a particular users position in the table and the two above and below like so for user 1 who is seventh:
Position UserId Total
5 9 18
6 6 15
7 1 10
8 2 5
9 4 3
I hope this makes sense and any help/insight would be greatly appreciated.
You could try: