Simple SELECT...

  •  Hi all,

    for some reason (stupidity maybe) I can't solve this problem...

    I have a table with this information:

     ID    SerialNumber         Result

    1         123                   Pass

    2         125                   Fail

    3         234                  Pass

    I just want a select that shows how many pass and fail...

    Like this:

    Pass | Fail

    2       |  1

    Thank you

     

  • SELECT COUNT(case Result when 'Pass' then 1 else NULL end) as Pass,

    COUNT(case Result when 'Fail' then 1 else NULL end) as Fail

    FROM ...

    _____________
    Code for TallyGenerator

  • I personally would add a third column and change the script so that NULLs showed up as Unknown.

    Then if you have Unknowns, you can go back and further investigate them. Or you might have entries where the course/test/whatever isn't finished.

    -SQLBill

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply