Here's my query:
SELECT *
FROM daily_records
AND date = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
I use this to generate a report of everything that happened yesterday. This works great, Tuesday-Friday. However, on Mondays, I want it to be able to search back to Friday (the previous business day, eg INTERVAL 3 DAY
).
Is there a way to do this in mySQL? Or do I just need to check the day of the week in PHP before writing the query?