0
I have a table where you store test notes. Ex.:
Name, Nota1, Nota2, Nota3, 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 verify that Ana took first, João in second and Pedro in third in the column Nota1 of the Drawing course. Thus:
Curso Desenho
1º lugar Ana
2º lugar João
3º lugar Pedro
I understand if I use it that 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 take 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 she took 1st and so on?
Possible duplicate of How to pick a user’s position individually in a rank, if in the database I only have their score?
– Woss