Search code examples
mysql

Find events with end date + 3 days


I have a table with events with start and end dates. I need to select the events that have passed, but only if 3 days have passed since the end date.

My current query is:

WHERE end_date < CURDATE() ORDER BY date DESC

I need it to be something like:

WHERE end_date + 3 days < CURDATE() ORDER BY date DESC

What would be the correct syntax?


Solution

  • You need DATE_ADD:

    WHERE DATE_ADD(end_date, INTERVAL 3 DAY) < CURDATE() ORDER BY date DESC