Given a table named "grades":
STUDENT GRADE
john 94
john 76
john 83
john 87
john 90
I want a query to return a few examples of grades for each student, for example:
STUDENT GRADE1 GRADE2 GRADE3 GRADE4
John 94 76 83 87
Notice there are only 4 sample grade columns returned but there are more than 4 grades for this student.
I only know how to return 2 example grades using the min() and max() functions in a GROUP BY clause:
select student, min(grade), max(grade)
from grades
group by student
Are there any tricks or functions other than min/max that will enable display of more than only 2 grades using the GROUP BY clause?
I'd rather not write my own stored function to do this unless it were part of the query rather than stored in the database.
I'm thinking of more functions that returned other values from the recordset besides the MIN and MAX (like the second highest, 3rd highest, etc).
Ideas?