Answer the question
In order to leave comments, you need to log in
How to correctly compose SQL with date interval?
In short, the script runs every 15 minutes. Its task is to select all records (to run the notification script) that have a time-date (timestamp) field 30 minutes from the current one. Those. between (+ 30 minutes and + 45 minutes), but I did something with the request and it seems to me that this is not correct.
SELECT id FROM TABLE WHERE event_date between NOW() + INTERVAL 30 MINUTE and NOW() + INTERVAL 45 MINUTE
Answer the question
In order to leave comments, you need to log in
Due to different delay times when running the script, some entries may be selected several times, and some may not be selected at all. In addition, even when starting immediately, recording times that are multiples of 15 minutes will be selected twice since BETWEEN selects inclusive.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question