select count(qq) from (select distinct qq,da from table) as table where da between unix_timestamp('2013-5-10') and unix_timestamp('2013-5-20');
select QQ,if(count(QQ)=0,0,1) as counts from tab_name where 日期 between '2013-05-10' and '2013-05-20' group by QQ
额,上面那句是总的报名人数, 日期da时间戳格式; select date_format(from_unixtime(da),'%Y-%m-%d') as date, count(qq) as num from (select distinct qq,da from table) as table where da between unix_timestamp('2013-5-10') and unix_timestamp('2013-5-20') group by date;
select count(distinct qq) from 表名 between 开始时间 and 结束时间
select count(distinct qq) from 表名 where 时间字段 between 开始时间 and 结束时间
表字段(时间)是varchar或date类型 均可以使用"between . and ." 和 " > ,<"直接比较,试试看吧,实践是检验真知的唯一标准!
select date_format(from_unixtime(da),'%Y-%m-%d') as date, count(qq) as num from (select distinct qq,da from table) as table where da between unix_timestamp('2013-5-10') and unix_timestamp('2013-5-20') group by date;
select count(distinct qq) from 表名 where 时间字段 between 开始时间 and 结束时间