D
D
dienerie2021-06-24 16:05:21
MySQL
dienerie, 2021-06-24 16:05:21

How to display records no earlier than half an hour and no later than an hour in sql?

There is a date field when the entry was created.
Need to pick.
How to withdraw lately I understand, interval or stamp.
And how not to do it before half an hour? And no later than an hour.

That is, a record that is 26 minutes old should not be displayed in the request, but if it is already more than 30, then it is necessary. If the recording is more than an hour, then it is not necessary.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Akina, 2021-06-24
@dienerie

WHERE created_at BETWEEN CURRENT_TIMESTAMP - INTERVAL 1 HOUR
                     AND CURRENT_TIMESTAMP - INTERVAL 30 MINUTE

G
Gucciprado1337, 2021-06-24
@Gucciprado1337

just write the function if , else and set through the signs indicating less than more ">" "<" ">=" "<=" and that's it :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question