hi
thank you all.
thanx susarlasireesha, I didn't try the order by max(grade)
didn't think it is possible.
this is what made it work. :-)
my problem now is that I have added one more field to tblGrades:
subject
if I only add to the SELECT the tblGrades.subject, and to the GROUP BY i add tblGrades.subject,
all the data that is arriving is messed up. I simply get more than one user.
(for example: Adam appears more than once in my results).
this is my code
Code:
SELECT tblGrades.user, tblGrades.subject, max(tblGrades.Grade) grad
FROM tblGrades
group by tblgrades.user, tblGrades.subject
ORDER BY max(tblGrades.Grade);
why can't it simply still group the user to appear unique (only one user name, his grade and subject)?
What I get is that bad result:
Code:
user Grade Subject
----- -------- ----------
Adam 100 math
Adam 99 history
Adam 20 geology
Adam 11 lidriture
Roy 55 sports
Roy 10 science
and what I want to get is this:
Code:
user Grade Subject
----- -------- ----------
Adam 100 math
Roy 55 sports
why cant i make it work?