Hi,

I have a table of grades like this:

title, section, instructor, letter_grade, number_grade, uid

With data that would look like this:

English, 1, Smith, B, 88, 1
English, 1, Smith, B, 86, 1
English, 1, Smith, B+, 89, 1
Math, 1, Jones, A, 95, 2
Math, 1, Jones, B, 85, 2
Math, 2, Smith, C, 75, 3
Math, 2, Smith, B-, 82, 3

I want a query that will give me something like this:

uid, average_grade, A_count, B+_count, B_count, B-_count, C_count
1,     87.67,          0,        1,      2,        0,       0
2,     90,             1,        0,      1,        0,       0
3,     78.5            0,        0,      0,        1,       1


I can do this is a separate query for each grade, but that makes a lot of little queries. Is there a way to do this in one query? Or am I just going to have to break the average out and do the counts in one query and the average in another?


Thanks,

bob

======================================================================
Bob Ramsey          SYSTEMS ADMINISTRATION AND SYSTEMS PROGRAMMING III
MA, Management of Information Systems 2004
MA, English Literature, 1992
ph:  1(319)335-9956                              187 Boyd Law Building
fax: 1(319)335-9019                  University of Iowa College of Law
mailto:[EMAIL PROTECTED]                Iowa City, IA 52242-1113
For Hardware and Software questions, call 5-9124
======================================================================


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to