获取布尔MYSQL的计数

时间:2015-12-31 18:35:57

标签: mysql database count

我无法从MySQL表中获取信息。我有一个类似于下面的表格,我想看看我每天有多少boolean=1个条目。我尝试使用count(boolean)日期类似于' 12 / __ / 2015'但我得到了总和,虽然我想要每天的个人结果集。

>     id/time   date        boolean(TINYINT(1))
>     1 12.11   12/23/2015  0
>     2 12.12   12/23/2015  1
>     3 12.13   12/23/2015  1
>     4 12.14   12/23/2015  1
>     5 12.15   12/23/2015  0
>     6 13.11   12/25/2015  1
>     7 13.12   12/25/2015  0
>     8 13.13   12/25/2015  0
>     9 13.14   12/25/2015  0
>     10 13.15  12/25/2015  1

1 个答案:

答案 0 :(得分:0)

试试这个:

SELECT count(boolean), date from [yourtable] where boolean=1 group by date

这应该为您提供所需的计数,同时忽略时间列。