I am trying to create an AVG
of student scores in classic asp. Here is my student table:
Name Q1 Q2 -------------- John 92 84 John 89 0 John 0 0
Here is my sql query:
SELECT Name, SUM(Q1)/count(*) AS Q1, SUM(Q2)/count(*) AS Q2
FROM table Student
"0" should not be counted.
Q1 should be
92+89/2
or Q2 should be
84/1
However, the result for both always divide by 3
How do I subtract 1 from any row that has 0
?