I have following two tables (student and marks): In student table I have information about students and in marks table I have information about the marks that the students have got. Now could you please tell me how to find out who got the highest mark calculating the total obtained mark from marks table ?
Thanks in Advance 🙂
p.s. Some may find the question duplicate of this- how to find the highest value in mysql table but in my defense my question is slightly different. 🙂
Student Table:
studentid student_name
1001 Jon Bon Jovi
1002 Charlie Sheen
1003 Jason Statham
... Goes on like this
Marks Table:
id studentid totalmark obtainedmark
1 1001 20 12
2 1002 20 20
3 1003 20 15
4 1001 50 40
5 1002 50 50
6 1003 50 45
... Goes on like this
This will return the person with the highest sum of obtained marks:
Looking at your table though, perhaps it is more useful to return the highest average test score returning their average percentage obtained. You can do this using the following I believe: