04-23-10, 10:40 #1Registered User
- Join Date
- Jun 2009
Unanswered: Getting earliest date from several columns in one row.
I have a database set up with fields to input different dates for different reasons. I have a query set up to bring back those dates and what I'd like to do is have the query identify the date that is the earliest. How can I do this?
The query is bringing back the following information from my table:
Job# WXdate ctdate furdate whdate earlydate
a1234 2/5/2010 2/10/2010 2/25/2010
So what I'd like is for the earlydate field to populate with the earliest date from this selection.
I've tried doing an if statement where If wxdate is less than ctdate and etc. But sometimes the dates will be the same and then it won't return any date at all. Any help would be appreciated. Thanks.
04-23-10, 11:01 #2Jaded Developer
Provided Answers: 59
- Join Date
- Nov 2004
- out on a limb
populating early date field violates the principles of normalised design
you could get what you want by using a compound IIF statement
acontrol = iif(wxdate<ctdate,iif(wxdate<ctdate,wxdate,cxdate) ,iif(ctdate<cxdate,cxdate,ctdate))I'd rather be riding on the Tiger 800 or the Norton