Link to home
Start Free TrialLog in
Avatar of vpekulas
vpekulas

asked on

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


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.
ASKER CERTIFIED SOLUTION
Avatar of Eric Flamm
Eric Flamm
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pique_tech
pique_tech

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))
Select avg(fldUPDATED - fldSTART) from YourTable

How do you want to express the average? (hours, minutes, seconds)
Select Format(avg(fldUPDATED - fldSTART), "dd hh:nn:ss") from YourTable
SELECT Avg(DateDiff("d",[fldstart],[fldupdated])) AS Expr1
FROM tbl_issue;
wow... everyone at once.
Avatar of vpekulas

ASKER

Thanks guys, exactly what I needed :)