having COUNT(case when Issue_Status = 'Open' and B.MILESTONESTATUS < 49 and currentSeverity = '1'THEN 1 else NULL End) > 0directly under your query, i.e. after the line reading
GROUP BY A.PrimaryBusinessOwner, B.MILESTONESTATUSthen it will eliminate all the rows which have a value of zero in the Sev1Red column of your final result.
having SUM (case when Issue_Status = 'Open' AND B.MileStoneStatus < 49 AND currentSeverity = '1' THEN 1 ELSE 0 END) > 0directly under the group by statement
HAVING COUNT (case when Issue_Status = 'Open' and B.MILESTONESTATUS < 49 and currentSeverity = '1'THEN 1 else NULL End) > 0 OR COUNT(case when Issue_Status = 'Closed' and B.MILESTONESTATUS < 49 and currentSeverity = '1'THEN 1 else NULL End) > 0You can optionally choose to use having count(first case clause) + count(second case clause) + etc > 0. For example,
HAVING COUNT (case when Issue_Status = 'Open' and B.MILESTONESTATUS < 49 and currentSeverity = '1'THEN 1 else NULL End) + COUNT(case when Issue_Status = 'Closed' and B.MILESTONESTATUS < 49 and currentSeverity = '1'THEN 1 else NULL End) > 0
No one has followed this question yet.