[thelist] SQL Query Question

Jay Blanchard jay.blanchard at niicommunications.com
Wed Aug 13 14:02:57 CDT 2003


[snip]
Basically I have a table in my access db called StartDate which will be
the date a customer started with us.  I also have a column called
DaysLeft which I hope to be a numerical
countdown column that will show how many days the customer has left
before their 90 day tech support is
over. 
[/snip]

You don't need a DaysLeft column at all --

1. Method One - calc the end date for the customer when put into the
database, if today = or > that date, tech support is over. To calc
number of days SELECT (EndDate - CURRENT_DATE()) AS DaysLeft FROM table 
2. Method Two - DATE_ADD to the StartDate, if today is = or > that date,
tech support is over. To calc number of days SELECT((DATE_ADD(StartDate,
INTERVAL 90 DAYS))-CURRENT_DATE()) AS DaysLeft FROM table



More information about the thelist mailing list