Попробуйте это
;WITH CTE(ci ,vi )
AS
(
SELECT 1 ,7 UNION ALL
SELECT 2 ,0 UNION ALL
SELECT 3 ,0 UNION ALL
SELECT 4 ,7 UNION ALL
SELECT 5 ,7 UNION ALL
SELECT 6 ,10 UNION ALL
SELECT 7 ,15 UNION ALL
SELECT 8 ,0 UNION ALL
SELECT 9 ,16 UNION ALL
SELECT 10 ,7 UNION ALL
SELECT 11 ,0 UNION ALL
SELECT 12 ,35
)
SELECT vi,COUNT(vi) Occurence
FROM CTE
WHERE vi IN (7,0) -- Specific values count Required use this where condition else remove
GROUP BY vi
Результат
vi Occurence
--------------
0 4
7 4