简体   繁体   中英

How do I group following dates in MySQL

I have a timeseries of discharge data. I want to select certain peak events. What I did was calculate a treshold, and made a table with the exceeding periods:

%create the treshold value
select min(dummie.value) from (select top 5 percent value from timevalues where id = 
(select id from source where type = 'observation') as dummie) as treshold

%view every time where the value is higher then treshold
select name, time, value from timevalue, catchment
where timevalue.sourceID = source.id 
and where source.id = catchment.sourceID
and where value >= treshold.value 
as exceed_table

Now I want all the periods that the values are above this treshold, and then count how many they are. is there a way to remove all the data where it's one timestep further then the one before?

Thanks!

我通过以下方法解决了该问题:复制了extra_table,在其中添加了一个时间步,然后减去了extra_table和所复制的一个。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM