2013-11-23 59 views

回答

2

像這樣的東西應該工作:

select sum(case when value = 1 then 1 else 0 end) ones 
, sum(case when value = 0 then 1 else 0 end) zeros 
1

試試這個

select sum(if(value=0,1,0)) as zeros, 
     sum(if(value=1,1,0)) as ones 
from mytable