• Here's an UNPIVT example:

    select iasmtID, sum(case when answer=1 then 1 else 0 end) as countOfOnes,

    sum(case when answer=2 then 1 else 0 end) as countOfTwos

    from

    (

    select iasmtid,question,answer

    from (select

    iasmtID,q1,q2,q3,q4,q5,

    q6,q7,q8,q9,q10,q11,q12,

    q13,q14,q15,q16,q17,q18,q19,q20

    from itcc_test) t

    UNPIVOT (ANSWER for Question in

    ([q1],[q2],[q3],[q4],[q5],

    [q6],[q7],[q8],[q9],[q10],

    [q11],[q12],[q13],[q14],[q15],

    [q16],[q17],[q18],[q19],[q20])

    ) unpvt

    ) as renormalizedTable

    WHERE iasmtID=3

    group by iasmtID

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?