select strBusinessFunction,
SUM(CASE WHEN strCondItionStatus ='A'and strTestPlan = @TestPlan THEN 1 ELSE 0 END)AS 'A',
SUM(CASE WHEN strCondItionStatus ='U'and strTestPlan = @TestPlan THEN 1 ELSE 0 END)AS 'U',
SUM(CASE WHEN strCondItionStatus ='X'and strTestPlan = @TestPlan THEN 1 ELSE 0 END)AS 'X'
FROM tblconditions
-- insertText
WHERE strCondItionStatus in ('A', 'U', 'X')
-- end insertText
GROUP BY strBusinessFunction
ORDER BY strBusinessFunction
Just adding a WHERE clause I think will be more performant, and I think this get the same result.
Chris Hofland