有表如下:
id, QQ,日期 三个字段想统计出一个时间段内的报名人数,比如5月10日-5月20日每天的报人数。
(注:同一个QQ号一天内可能会报名很多次,这个是要忽略的,都按一个算).谁知肿么写...统计合拼
id, QQ,日期 三个字段想统计出一个时间段内的报名人数,比如5月10日-5月20日每天的报人数。
(注:同一个QQ号一天内可能会报名很多次,这个是要忽略的,都按一个算).谁知肿么写...统计合拼
调试欢乐多
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 结束时间