I have a table with subscription information. I am trying to get it to return results where the date is within a certain range, the range being the date of subscription, plus x years, where x is a field in each row.
I have the following fields, (plus more but i removed to keep easy) and I want to extract all expired memberships. I have used the following statement, however it doesnt take into account the days of the month, and returns fields that are going to expire that month.
Is this even possible? Or do I have to filter results with php?
sponsorshipID | sponsorID | start_date | years | ...
sponseeID | lname | fname |...
FROM 2b_sponsees as t1
INNER JOIN 2b_sponsorships as t2
ON t2.sponseeID = t1.sponseeID
WHERE t2.sponsorID = 4 AND (YEAR(CURDATE())-YEAR(t2.start_date))-((MID(CURDATE(),6,2)< MID(t2.start_date,6,2) && (MID(CURDATE(),6,2)< MID(t2.start_date,6,2)) >= t2.years AND t2.auth = 1
ORDER BY t2.start_date ASC