1、select month(LoginTime) as months,count(*)as 次数 from table where year(LoginTime)='输入的年份' group by month(LoginTime) 2.select day(LoginTime) as days,count(*) as 次数 from table where year(LoginTime)='输入的年份'and month(LoginTime)='输入的月份' group by day(LoginTime) 3.select hour(LoginTime) as hours,count(*) as 次数 from table where year(LoginTime)='输入的年份'and month(LoginTime)='输入的月份'and day(LoginTime)='输入的日期' group by hour(LoginTime)
2.select day(LoginTime) as days,count(*) as 次数 from table where year(LoginTime)='输入的年份'and month(LoginTime)='输入的月份' group by day(LoginTime) 3.select hour(LoginTime) as hours,count(*) as 次数 from table where year(LoginTime)='输入的年份'and month(LoginTime)='输入的月份'and day(LoginTime)='输入的日期' group by hour(LoginTime)
多谢你的答案,不过你只统计登陆时间,而我需要的是在LoginTime-LogoutTime,这个区间内
的时间比如说,一个用户LoginTime等于2005-07-31 15:15
到第二天,就8月了,我如果按你的方法是统计不到8月的数据
能说得详细一点吗?多谢