Get the App
SLTechnology News&Howtos  ›  Database  › 

How to implement interval query in a period of time

Shulou Source: shulou.com Published: 2022-05-31 17:39:18 10月03日 Update

This article mainly introduces "how to carry out interval query within a period of time". In daily operation, I believe many people have doubts about how to carry out interval query within a period of time. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubt of "how to realize interval query in a period of time". Next, please follow the editor to study!

I want to query the data within a period of time and then according to the interval

Select * from monitor thermometer where monitor thermometer. Time between'"+ Str (dtStart.Value) +" 'AND' "+ Str (dtEnd.Value) +" 'order by id

This is a query within a period of time. Now we need to add a time interval to query. I don't know what to say. I hope the master will answer.

Where dtStart.Value and dtEnd.Value are DTPicker1 controls

For example: for example, my query period is between 2007-1-5 19:03:31 and 2007-4-8 10:38:21. I think there is a data every few seconds and now I don't want him to take it all out. I need 5 minutes or how much time to get a data. If I have a record at 19:03:31 on 2007-1-5, the next record is directly 2007-1-5 19:08:31 (if not, it is closest to taking a record before and after this record). And at 2007-1-5 19:03:31, a lot of data will not be displayed at 2007-1-5 19:08:31. Thank you.

Try

Select * from Monitoring thermometer A where time between'"+ Str (dtStart.Value) +" 'AND' "+ Str (dtEnd.Value) +" And Not Exists (Select time From Monitoring thermometer Where DateDiff (mi, time, A. Time)

Tags: Time temperature thermometer monitoring query time period data learning for example between representative that is gap more A. practice help solution practical do not know what to say Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Docker Apple OPPO Reno Xiaomi