create table t_visitonline
(
id bigint(20) not null auto_increment,
online int(11) comment '在线人数',
counter int(11) comment '累计访问量',
loginer int(11) comment '在线登录人数',
recordtime datetime not null comment '记录时间',
primary key (id)
);
alter table t_visitonline comment '访问量统计';
/*==============================================================*/
/* Index: Index_real_visitonline_date_1 */
/*==============================================================*/
create index Index_t_visitonline_date_1 on t_visitonline
(
recordtime
);
数据记录如下图示:
现在我要按某一段时间内来统计查出online、counter、loginer的最大数,这个时间段有可能是一个月的每一天,有可能是某一天的每一个小时,也就是说,每一天里查出online、counter、loginer的最大数,或者每一个小时里查出online、counter、loginer的最大数,分别显示,有谁能给出个好点的SQL语句或存储过程么?
在这也有提问《有谁能给出个好点的SQL语句或存储过程么?》,先谢谢大家的帮助。