O
O
Oleg2018-07-25 21:20:22
MySQL
Oleg, 2018-07-25 21:20:22

How to select from mysql database by condition?

I need to select users from the customers table who registered 15 minutes ago, but not earlier
. That is, if it is now 21:10 and the user registered at 21:00, then with a sql query, he should get out at 21:15, but not earlier .
I had an idea

SELECT * FROM customer WHERE status = 1 AND date_added >= DATE_SUB(NOW() , INTERVAL 15 MINUTE)

But that's not it. This selects users who have registered within a span of 15 minutes. And I need exactly 15 back

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2018-07-25
@bysobi

replace more with less if I understand correctly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question