Mysql previous date
I am using the following to have the previous date data at 00.00.00
select * from perf where timeStamp="SUBDATE(CURDATE(),1)";
But that doesn't lead to an exit
where as
select * from perf where timeStamp="2014-11-28";
the result is correct output
Can any of you please help me in trying to figure out the problem. Any help is greatly appreciated.
+3
source to share
3 answers
Check the SUBDATE () Function
Try the following:
SELECT *
FROM perf
WHERE DATE(timeStamp) = SUBDATE(CURDATE(), INTERVAL 1 DAY);
+2
source to share