offers.date = CURDATE()
I what I currently have.
It grabs offers for today, but I also would like to grab the orders for yesterday.
How can I do this, without specifying the yesterday’s date?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To use CURDATE minus or plus a interval (e.g. yesterday) you can use the DATE_ADD function
So, in your case you use it like this:
Optionally you can also use the DATE_SUB() function and instead of a negative interval use the same interval but positive.
Thus,
DATE_ADD(CURDATE(), INTERVAL -1 DAY)would becomeDATE_SUB(CURDATE(), INTERVAL 1 DAY)