Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement interval query in a period of time

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report