[Solved] Msg 116, Level 16, State 1


A subquery in the SELECT can only select one attribute. I’m not sure what you are trying to do, but you’ll have to re-write to something like:

SELECT   NUMBER
,        STATUS
,        ID
,        SUM(CASE 
                  WHEN STATUS like 'closed' and OPEN_TIME >= @DateFrom and CLOSE_TIME <= @DateTo 
                     THEN 1 
                  ELSE 0 
             END) as closen
,        {same for the other counts}
FROM     dbo.PROBS
GROUP BY NUMBER
,        STATUS
,        ID

solved Msg 116, Level 16, State 1