SQL Query Compare values in per 15 minutes and display the result per hour

后端 未结 3 534
感动是毒
感动是毒 2021-01-24 02:04

I have a table with 2 columns. UTCTime and Values. The UTCTime is in 15 mins increment. I want a query that would compare the value to the previous value in one hour span and di

3条回答
  •  温柔的废话
    2021-01-24 03:03

    select SUBSTRING_INDEX(UTCTime,':',1) as time,value, count(*)-1 as total
    from foo group by value,time having total >= 1;
    

    fiddle

提交回复
热议问题