ackerchez ackerchez - 1 year ago 70
MySQL Question

Get records where today is 6 months after date

I am trying to run a query and get all the records where today is 6 months after the start date.

Here is what I have but it doesn't seem to be working. What am I missing?

select * from users where DATE_ADD(start_date, INTERVAL 1 MONTH) = CURDATE()


Answer Source

This is too long for a comment. First, your code is checking for one month rather than 6 months.

The first possibility is that you don't have any records on that date.

Another is that the dates have times associated with them. If so, you can do:

where DATE_ADD(DATE(start_date), INTERVAL 6 MONTH) = CURDATE()
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download