1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > mysql 提高查询效率 mysql如何查询时间间隔大于5分钟的数据时间从现在往前推 –

mysql 提高查询效率 mysql如何查询时间间隔大于5分钟的数据时间从现在往前推 –

时间:2022-02-22 01:38:55

相关推荐

mysql 提高查询效率 mysql如何查询时间间隔大于5分钟的数据时间从现在往前推 –

;declare thisname varchar(10)

;declare done tinyint default 0;declare cur cursor for select dtime,name from `table`

;declare continue handler for sqlstate 2000 set done=1;create temporary table if not exists `tmp`(dtime datetime, name varchar(10));while done1 doif lastdtime is null thenfetch cur into lastdtime,lastname;elsefetch cur into thisdtime,thisname;if timediff(thisdtime,lastdtime)>0:05:00 theninsert into `tmp` (dtime,name)values(lastdtime,lastname)

;set lastdtime=thisdtime;set lastname=thisname;end if;end if;end while;select * from `tmp`;End//call findtime()//

mysql 提高查询效率 mysql如何查询时间间隔大于5分钟的数据时间从现在往前推 – 数据库 – 前端 mysql django

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。