本人想查询每天tongji表里字段op=1的数量统计,而且结果要按天输出
求高手指点
求高手指点
解决方案
13
select date,count(0) from tongji where op=1 group by date;
13
select date,count(case when op=1 then 1 end) as cn from tongji group by date;
14
select CreateDate,count(*) from t_housebookin group by CreateDate
查询结果
CreateDate (无列名)
2012-07-11 00:00:00.000 54
2013-10-23 09:31:44.000 1
2008-03-05 00:00:00.000 51
2000-03-10 00:00:00.000 1
1988-07-26 00:00:00.000 1
2011-10-24 00:00:00.000 52
查询结果
CreateDate (无列名)
2012-07-11 00:00:00.000 54
2013-10-23 09:31:44.000 1
2008-03-05 00:00:00.000 51
2000-03-10 00:00:00.000 1
1988-07-26 00:00:00.000 1
2011-10-24 00:00:00.000 52