There are several ways to do this. Here is one.
You need a lookup table for the grade values. Let's call this "ValueLookup".
It will contain two columns. One for the grade letter (column named TheKey), and one for its matching value (column named TheValue).
It will contain a row for each Grade in your system:
A 5
B 4
C 3
D 2
E 1
Or whatever.
Then, for each column in your grades table, you need to do a subquery and add up all the values for a row. It would look something like this (this example just uses 3 columns for brevity):
Code:
SELECT ((SELECT a.TheValue From ValueLookup a Where a.TheKey = b.Col1)
+ (SELECT a.TheValue From ValueLookup a Where a.TheKey = b.Col2)
+ (SELECT a.TheValue From ValueLookup a Where a.TheKey = b.Col3)) AS RowTotal
FROM Grades AS b;
The result will be a table of rows with a single column in each row named RowTotal with a value that is the sum of all the "looked up" grades for that row. Make sense?
Of course, you need to use the column and table names that are in your database.
Cheers,
Woody Z
http://www.learntoprogramnow.com
How to use a forum to help solve problems
My blog... please visit