Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-10-15
7
Medium Priority
?
378 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 8

Accepted Solution

by:
Eric Flamm earned 1200 total points
ID: 12323637
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
ID: 12323657
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
ID: 12323667
Select avg(fldUPDATED - fldSTART) from YourTable

How do you want to express the average? (hours, minutes, seconds)
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
LVL 16

Expert Comment

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

Expert Comment

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

Expert Comment

by:mcorrente
ID: 12323702
wow... everyone at once.
0
 

Author Comment

by:vpekulas
ID: 12323967
Thanks guys, exactly what I needed :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
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 specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

610 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