using the sum function?

  • Thread starter Thread starter Brent
  • Start date Start date
B

Brent

I have a database that is used to tally quiz results.
The DB has three tables, one is where user information is
collected including their answers, the second table
includes a list of questions, and the third includes a
list of values corresponding to the quesitons. For
instance, there are four questions for every answer, but
only one quesiton has a value of 1 (true) and the other
three (wrong) questions have a value of 0.

What I'm having trouble doing is putting together a query
that tallies the number of 1's and 0's for every person
who takes the quiz. Any suggestions????
 
I don't quite grasp your structure but perhaps this sample will help

SELECT PERSONID, Abs(Sum(Answer=1)) as TrueCount,
Abs(Sum(Answer=0)) as WrongCount
FROM YourTable
GROUP BY PersonId
 
Back
Top