Sum and Compare results in SQL Statement

  • sum(Case when answera = 2 then 1 else 0 end) as answera

    sum(Case when answerb = 2 then 1 else 0 end) as answerb

    from sometable

    I'd like to then compare answera with answerb in the statement

    and show

    if the sum of answerb is greater than answera

    or answera is = answerb

    or missing data from answera and answerb

    e.g.

    # who had a score of 4 both times or improved by 1

    # in 3 months with both pieces of information

    # missing one or both assessment results

    thanks,

    how do I go about doing that?

  • Duplicate. Please delete this entry.


    * Noel

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

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