您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

mysql每半小时平均值计算的sql语句_MySQL

2026/1/29 20:54:07发布13次查看
表结构:
create table `instance` ( `id` int(11) unsigned not null auto_increment, `timestamp` int(10) unsigned default null, `cpu` decimal(8,3) default null, primary key (`id`)) engine=innodb;
统计每半小时平均值,实现可以如下:
select `timestamp`-`timestamp`% (5*60) , avg(cup)from `instance`group by `timestamp`-`timestamp`% (5*60)
另外还有:
select queuename, hour(dt) as h, floor(minute(dt) / 30) as v , avg(memoryused), sum(memoryused), count(memoryused) from queue_resource where dt>='2014-04-14 00:00:00' group by h, v, queuename;
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product