回答

1

你可以試試這個:

select count(Allowed) as count 
from yourtable 
group by Allowed 
2

要獲得允許的數量與各自的值一起:

SELECT Allowed, COUNT(Allowed) AS AllowedCount 
FROM TestTable 
GROUP BY Allowed 

結果:

Allowed AllowedCount 
----------------------- 
    0   3 
    1   3 

工作SQL小提琴:http://sqlfiddle.com/#!3/500b8/3

爲了得到這兩個值0和1的准入計數:

SELECT COUNT(Allowed) AS AllowedCount 
FROM TestTable 
WHERE Allowed IN (0, 1) 

工作SQL小提琴:http://sqlfiddle.com/#!3/500b8/5