请问一下grafana展示数据源是elasticsearch的数据的话如何实现引用查询啊?
发布网友
发布时间:2022-05-20 19:00
我来回答
共1个回答
热心网友
时间:2023-11-13 16:12
你表中的数据,根据你的题目,应该是全部显示才对。是小于5秒还是5分钟?
下面这个是 两条数据间小于5秒的记录的查询语句
select *,timestampdiff(second,t1.time,(select time from table3 where t1.id<id order by id limit 1) ) td ,timestampdiff(second,(select time from table3 where t1.id>id order by id desc limit 1),t1.time ) td1from table3 t1 where timestampdiff (second,t1.time,(select time from table3 where t1.id<id order by id limit 1) )<5ortimestampdiff(second,(select time from table3 where t1.id>id order by id desc limit 1),t1.time )<5 order by t1.id