Solved

Generating Average time difference between 2 dates in MS Access (SQL)

Posted on 2004-10-15
7
358 Views
Last Modified: 2008-03-10

I have a table with this structure in Access database

tbl_issue
 - ID             (autonumber)
 - fldSTART       (Date/Time)
 - fldUPDATED     (Date/Time)


Now I need to find out the average difference between the 2 dates above
for all records. Question is how would I go about it ?
Thanks in advance.
0
Comment
Question by:vpekulas
7 Comments
 
LVL 8

Accepted Solution

by:
Eric Flamm earned 300 total points
Comment Utility
SELECT Avg(DateDiff("d",[fldStart],[fldUpdated])) AS Expr1
FROM tbl_issue

This will give you the average in days ("d") - check help on DateDiff for more options.

-ef
0
 
LVL 12

Expert Comment

by:pique_tech
Comment Utility
In a query, you'd need a field defined as:  (this will return minutes, if you want hours, change "n" to "h", days "d", etc)

AvgDifference:  Avg(DateDiff("n",fldSTART,fldUPDATED))
0
 
LVL 16

Expert Comment

by:Nestorio
Comment Utility
Select avg(fldUPDATED - fldSTART) from YourTable

How do you want to express the average? (hours, minutes, seconds)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 16

Expert Comment

by:Nestorio
Comment Utility
Select Format(avg(fldUPDATED - fldSTART), "dd hh:nn:ss") from YourTable
0
 
LVL 6

Expert Comment

by:mcorrente
Comment Utility
SELECT Avg(DateDiff("d",[fldstart],[fldupdated])) AS Expr1
FROM tbl_issue;
0
 
LVL 6

Expert Comment

by:mcorrente
Comment Utility
wow... everyone at once.
0
 

Author Comment

by:vpekulas
Comment Utility
Thanks guys, exactly what I needed :)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now