Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2009
    Posts
    5

    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.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •