I'm trying to make a condition I want to select only the lines where the date field is 2h before at least but I can't find how to make this where clause.
The current date is:
2019-05-28 14:30:00
I have in database those line
2019-05-28 13:30:00
2019-05-28 10:30:00
I want to be able to catch the second one.
I could get all result one by one...turning them into timestamp...but I feel like I can do this in a simple sql request.
I was thinking about BETWEEN, but I don't see how it will worked in this case.
Thanks.
Issue solved:
If someone can post it as a response: We need a combinaison og DATE SUB and INTERVAL
SELECT * FROM `offer` WHERE updatedAt < DATE_SUB(NOW(), INTERVAL 2 HOUR);