Below is what I have
userid score
1 8
2 5
3 4
4 4
5 10
6 3
What I want is as below
userid score position
5 10 1
1 8 2
2 5 3
3 4 4
4 4 4
6 3 5
NOTE:
I have code where I have created below output,
userid score position
5 10 1
1 8 2
2 5 3
3 4 4
4 4 4
6 3 6
Code is
SELECT userid, score,
(SELECT COUNT(*) FROM fschema.mytab3 u2
WHERE
u2.score > u1.score) + 1 AS position FROM fschema.mytab3 u1
ORDER BY position
I want user 6 to have position as 5 instead of 6
What about this?