I have a table where I store test scores. Ex.:
Name, Note1, Note2, Note3, Course
The result is this:
Nome | Nota1 | Nota2 | Nota3 | Curso
Pedro | 7.6 | 5.5 | 3.2 | Desenho
João | 8.0 | 3.1 | 6.6 | Desenho
Ana | 9.0 | 6.5 | 2.2 | Desenho
I would like to check that Ana took first, John in second and Peter in third in column Note1 of the Drawing course. This way:
Curso Desenho
1º lugar Ana
2º lugar João
3º lugar Pedro
I understand that if I use it this way:
SELECT *, GREATEST(Nota1, Nota2, Nota3) AS MaiorNota FROM curso = '".$curso."' ORDER BY Nota1 DESC;
Or
SELECT * FROM curso = '".$curso."' ORDER BY Nota1 DESC;
I can get the highest grade and put it in order from highest to lowest, but how can I show Pedro that he took 3rd place, Ana that he took 1º and so on?