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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Average Time Query

Status
Not open for further replies.

omgm1ke

Programmer
Feb 27, 2007
8
GB
I have come stuck with averaging a column with type of Time.

I know there is a function AVG() that I can use to filter the average of a column, however, this brings back an integer.

Is there any way to return the average in time format (IE 00:00:00)?

BACKGROUND INFO:

SELECT `estimatedTime`
FROM job_sheet;

Returns,

01:00:00
21:30:00
01:00:00

The data type is time, and the default is 00:00:00.
 
Have you tried?
Code:
SELECT CAST( AVG(estimatedTime) AS TIME )
FROM job_sheet
 
Thanks r937, your query worked a charm!

rac2, your query brought back NULL, but thanks anyway.
 
Thanks for the report. Rudy is good, no doubt.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top