Differences in record values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 312student
    New Member
    • May 2010
    • 2

    Differences in record values

    I have a table with interview times (start and end times), and I am trying to find the largest gap between the times. I would need a query that takes the difference of the start time of one interview and the end time of another. Is there a way to do this in VBA or a query??
  • vb5prgrmr
    Recognized Expert Contributor
    • Oct 2009
    • 305

    #2
    If it was SQL Server... Okay, maybe a way... With SQL Server you can create a temporary table in memory, with access you would actually have to create a table with a select into. Either way, you would do the operation with the needed fields while appending a field. This appended field would allow you to store the difference between start/stop times and then you could select from that table with an order by.

    As for the exact syntax, your best bet is to use your friends (yahoo, google, ask, answers, bing) to search for the database you are using plus forum (Access Forum). I do know over at tek-tips they have several different database forums but hopefully someone will come along with the knowledge as I need to have the SQL help files up for this kind of thing but they are on my server and I don't surf with my server...



    Good Luck

    Comment

    • QVeen72
      Recognized Expert Top Contributor
      • Oct 2006
      • 1445

      #3
      Hi,

      If you have stored the Start and EndTime in DateTime Fields, then you can simply subtract the two..

      Select EndTime - StartTime From MyTable Order By
      (EndTime - StartTime ) Desc

      Regards
      Veena

      Comment

      • vb5prgrmr
        Recognized Expert Contributor
        • Oct 2009
        • 305

        #4
        shakes head, bows to the queen, then meekly asks, "What about an alias?

        Select (EndTime - StartTime) As TimeDiff From MyTable Order By
        (EndTime - StartTime) Desc

        Sometimes the simplist of answers can be overworked...

        Comment

        • dsatino
          Contributor
          • May 2010
          • 393

          #5
          Maybe I'm misreading this, but looks like student is trying to find the time difference between the start of the first interview and the end of the last interview...

          student?

          Comment

          Working...