This is my script
SELECT iBranch_num,
CASE WHEN iPatient_typ=1 THEN COUNT(iPatient_num) ELSE 0 END AS [New Patient],
CASE WHEN iPatient_typ=2 THEN COUNT(iPatient_num) ELSE 0 END AS [Buying Patient],
CASE WHEN iPatient_typ=3 THEN COUNT(iPatient_num) ELSE 0 END AS [Active Patient],
CASE WHEN iPatient_typ=4 THEN COUNT(iPatient_num) ELSE 0 END AS [Inactive Patient]
FROM tblsotransaction
WHERE iStatus_typ=1
AND iApply_dt BETWEEN 20130401 AND 20130408
AND iBranch_num=14
GROUP BY iBranch_num, iPatient_typ
Current Result:
14, 25, 0, 0, 0
14, 0, 8, 0, 0
14, 0, 0, 97, 0
14, 0, 0, 0, 2
I want the result to be like this
14, 25, 8, 9, 2