hello:
I'm trying to modify the following query so that it only select rows where
90 - DATEDIFF(CURDATE(),date) as days_remaining
is greater than negative 15. (days_remaining > -15)
$query="select servicearea, date, customerid, clientID, 90 - DATEDIFF(CURDATE(),date) as days_remaining from servicesrendered where servicearea=' Oil Change ' and DATEDIFF(CURDATE(),date) > 79 group by clientID order by id desc";
To put the query into perspective, essentially, if my date is 2011-01-15 and my $limit value is 90 days, the code performs a search in the table for records which have a servicearea value of " Oil Change " and using the date and the $limit to thus determines how many days are left --as of today, until those 90 days expire. In some cases, the query will return negative numbers where the target date has come and gone. It is here that want to create limit. After the -15 days, I want the query above to ignore any records with this number of days expired.
I hope this makes sense.
Any thoughts!
Mossa