Lars Berg wrote:Well bogu, your query will not give the desired result either.
Well I understand he what to select the name for each subject (uniq) with the bigest mark ..
Ex.
Subject = Math
The bigest mark is 72
Student: Michael
Thanks Lars Berg for pointing me that,u are right, my first query is wrong (I writed whitout thinking, no excuse) ...
Subquery is supported only if u are using mysql 4.1 or bigger (I'm limited to mysql 4.0), this select will do on lower versions too...
SELECT max(mark) as max_mark, subject, name FROM `table`
GROUP BY subject
This select give u this result:
max_mark subject name
73 Accounting Jason
77 Biology Jason
67 English Ellen
76 History Michael
72 Math Michael
54 Science Ellen