Answer the question
In order to leave comments, you need to log in
How to get data for today, yesterday, the day before yesterday... day?
How to get data for, for example, only yesterday?
My date is stored in Y-m-d H:i:s
.
Try this, but I get nothing in response:
SELECT * FROM `payments` WHERE `date` = DATE_SUB(NOW(), INTERVAL 1 DAY)
Answer the question
In order to leave comments, you need to log in
There must be a date range condition
SELECT *
FROM `payments`
WHERE `date` BETWEEN DATE(DATE_SUB(NOW(), INTERVAL 1 DAY)) AND DATE(NOW());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question