So I have a table as follows:
ID_STUDENT ID_CLASS GRADE
1 1 90
1 2 80
2 1 99
3 1 80
4 1 70
5 2 78
6 2 90
6 3 50
7 3 90
I need to then group, sort and order them to give:
ID_STUDENT ID_CLASS GRADE RANK
2 1 99 1
1 1 90 2
3 1 80 3
4 1 70 4
6 2 90 1
1 2 80 2
5 2 78 3
7 3 90 1
6 3 50 2
Now I know that you can use a temp variable to rank, like here, but how do I do it for a grouped set? Thanks for any insight!