比如有表: bbs_themes
dateline views
2008-07-11 10:00:00 12
2008-07-11 11:00:00 13
2008-07-11 12:00:00 23
2008-07-11 13:00:00 31
2008-07-11 14:00:00 32
2008-07-11 15:00:00 123
2008-07-11 16:00:00 213
2008-07-11 17:00:00 312
2008-07-11 18:00:00 321现在需要查询出从几点到几点的访问两最多?
比如结果返回:17 - 18 !
dateline views
2008-07-11 10:00:00 12
2008-07-11 11:00:00 13
2008-07-11 12:00:00 23
2008-07-11 13:00:00 31
2008-07-11 14:00:00 32
2008-07-11 15:00:00 123
2008-07-11 16:00:00 213
2008-07-11 17:00:00 312
2008-07-11 18:00:00 321现在需要查询出从几点到几点的访问两最多?
比如结果返回:17 - 18 !
解决方案 »
- 关于连接
- 刚开始试用MySql,问个问题
- 关于 ado 的 recordsetPtr 使用
- mysql 中文 不同的中文问题
- 使用游标出现 No data - zero rows fetched, selected, or processed
- mysql_query函数的问题
- 求教sql语句 如何从一个表中读取字段到另一个新建的表中(高分求救)
- 语法问题????
- MYSQL修改密码重新启动后还原原来状态!!
- 如何利用触发器禁止删除表中的id为 1的数据
- 中文分词服务器(C语言开发+词库+源代码),最大特色可以让javascript来调用!当然也可以让其他任何语言来调用
- 4000是不是超出了SMALLINT的范围阿
select a.dateline as at,b.dateline as bt,a.views-b.views as ce from t4 a left join t4 b on
timediff(a.dateline,b.dateline)=1
left join
(
select max(ce) as ce1 from (
select a.dateline as at,b.dateline as bt,a.views-b.views as ce from t4 a left join t4 b on
timediff(a.dateline,b.dateline)=1) a1
) a2
on a2.ce1=a.views-b.views where a2.ce1 is not null
select date_format(dateline,'%H'),sum(views) as vs from bbs_themes group by date_format(dateline,'%H') order by vs desc limit 0,1; 这样可以查询到时间是 18点 ,所以流量最大的是 18 - (18+1)!不知您有何高见???
而并不是一直累加过来的!我明白了!