I need some help setting up a query or refining a query for the following logic.
AVO_LASTDATE is the last inspection date
I only want to show inspections where AVO_LASTDATE is greater than or equal to 15 days ago, but not in this month of this year.
For example, if the AVO_LASTDATE is 1/4/2025, I shouldn't see it in the inbox until 2/1/2025.
If AVO_LASTDATE is 1/31/2025, I should see it in the inbox starting 2/15/2025
Inspections have to be at least 15 days apart but I can't do two in the same month. This is what I have now, but am getting a 400 error.
(CURRENT_DATE - 15 >= AVO_LASTDATE) AND MONTH(AVO_LASTDATE) != MONTH(CURDATE())
AND YEAR(AVO_LASTDATE = YEAR(CURDATE())