• This is not an optimal table design for doing what you want in SQL. It would be easier if your table was like this:

    userName answerNo answer

    test 1 right

    test 2 wrong

    test 3 right

    Then you could use

    select count(*) where answer = 'right'

    or

    select sum(case when answer = 'right' then 1 else 0 end)

    As it stands you have to check each column separately with case statements, and sum the results.

    select userName,

    case when answer1 = 'right' then 1 else 0 end +

    case when answer2 = 'right' then 1 else 0 end +

    case when answer3 = 'right' then 1 else 0 end +

    etc etc

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills