SELECT time_happend,COUNT(time_happend) AS COUNT FROM users_operation_history GROUP BY time_happend ORDER BY COUNT(time_happend) DESC
第一条为最多的一天
我用的是MSSQL的语法,取时间字段time_happend的日期部份就可以了,MSSQL可以这么写CONVERT(varchar(10),time_happend,120),MYSQL我就不太懂了。
select top 1 * from (select count(*) as ct from users_operation_history group by time_happend ) order by ct
select convert(varchar(10),time_happend,12),count(*)
from users_operation_history
group by convert(varchar(10),time_happend,12)
order by count(*) desc
以访问记录逆向排序得到访问次数最多的一天,不同数据库语法可能有稍微不同,有问题再说吧