Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Really simple query statistics question

Status
Not open for further replies.

osp001

Technical User
Nov 19, 2003
79
0
0
US
I'm trying to get a query to display the average age of a product for which I have a manufacturing date (fill_date) and a disposal date (termination_date). It's been a while since I've worked with Access, so I forget how to subtract one from the other in a query (in design view, if possible) so I can get the average age of all these containers. Any help?
 
add this to your query's SQL ...

SELECT ...
, AVG(DATEDIFF("d",fill_date,termination_date)) AS avg_age_in_days
, ....

and then switch over to design view to see it there

:)

r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
 
osp001,
"Containers" or "product" or something else?
Age expressed in what (hours, days, months, years,...)?
Can you share significant table and field names?

I expect your query would be a basic totals query with an expression similar to r937's suggestion.


Duane
Hook'D on Access
MS Access MVP
 
and don't forget to add the GROUP BY clause for all the non-aggregate fields in your SELECT

Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top