Home  >  Article  >  Database  >  over-mysql 相同ID 的 相邻时间拼接

over-mysql 相同ID 的 相邻时间拼接

WBOY
WBOYOriginal
2016-06-06 09:42:331162browse

mysqlovertimelead

我现在有个问题困扰很久了: mysql数据库,在一张表内,时间经过了一次处理,即同一agent_id下,一个小时内“切割”分开了几段来显示了,具体如下图,图中毫秒处切了.999的数据,现在想要拼接起来,即:同一agent_id,连续的时间拼接起来,作为一段时间,时间长(laststatus_tilelen相加),用存储过程要怎么实现? 或者用sql语句怎么实现? 这里有位高手写了一个:http://blog.csdn.net/danielinbiti/article/details/43031193,我把这个移植进去后发现,在秒数位59的时候,和下一时间段没有拼接成功,orader by 需要换成id才不会有null值,可能我哪里错了,没有实现,
图片说明
图片说明

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn