I have a table like this:
name | score
asdf | 50
zxcv | 100
qwer | 80
aaa | 70
.
.
.
and I could obtain someone's ranking via this query:
SELECT(
SELECT COUNT(*)
FROM leaderboard m2
WHERE m2.score >= m1.score
) as rank,name,score
FROM leaderboard m1
WHERE name='aaa'
and this query would give me something like this:
rank | name | score
3 | aaa | 70
The problem is the result I want to see with name='aaa' is like this :
rank | name | score
2 | qwer | 80
3 | aaa | 70
4 | asdf | 50
(with aaa's ranking and the around of aaa's result)
How could it be done?