I am new to mysql. I googled but couldn’t find any satisfactory answer.
Basically, I need to provide rank to student . The only thing to be considered is explained in given example.
Let we have a table student(id,marks,rank).
Now let the entries be
id marks
1 2
2 2
3 3
4 4
5 4
6 3
7 3
Here the ranks of id’s : 4 and 5 should be FIRST.
ranks of id’s : 3 , 6 and 7 should be THIRD.
ranks of id’s : 1 and 2 should be SIXTH.
What should be the query ?
Consider implementing ranking on the application side. If it really needs to be on the MySQL side, you can use user-defined variables: