SELECT
COUNT(logb.id)
FROM
rm_operate_log
WHERE CONCAT(
DATE_FORMAT(create_date, '%Y%m%d%H-'),
IF (
) DATE_FORMAT(create_date, '%i') > 30 ,
1,
0
)
) = CONCAT(
DATE_FORMAT(NOW(), '%Y%m%d%H-'),
IF (DATE_FORMAT(NOW(), '%i') > 30 , 1, 0)
)
The server has a script to grab data from the database every 30 minutes and then send push messages
1.DATE_FORMAT(create_date, '%Y%m%d%H-') Query create_date in the database Time format 'Year Month Day -'
2. DATE_FORMAT(create_date, '%i') > 30,
1,
0
) Query the time format of create_date in the database 'minutes' If greater than 30, it is 1 otherwise it is 0
3. Use concat() to connect the two strings
4 and then compare it with the current time
The above has introduced the script to execute mysql to query the corresponding data in half an hour, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.