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

MySql compares and gets the data before the current time x minutes (time is a string type)

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The first implementation method is to get the data before 15 minutes of the current time (addTime is the added time), 15 is the minute select * from sys_user where timestampdiff (second,date_add (addTime,interval 15 day_minute), now ()) > 0; the second implementation method is to obtain the data before 8 minutes of the current time (addTime is the added time), and 8 is the time interval select * from sys_user where timestampdiff (minute,addTime,now ()) > 8 The third implementation method is to obtain the data before 10 minutes of the current time (date_sub subtracts the specified time interval from the date, addTime is the added time). 10 is the time interval, which should be the most efficient of the three methods. It is recommended to use this method select * from sys_user where addTime < date_sub (now (), interval 10 minute).

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