ORACLE : How to Calculate Average of Date Values ?

Share

Are you getting trouble of calculating average time of a filed, where data type is date time ?
Don’t worry. You are at right place to get right solution.

I’m going to calculate average time of a filed.
If there is two time value in a day, i will calculate the first one means minimum one.

SELECT TO_CHAR(TRUNC(SYSDATE)+AVG(VDATE-TRUNC(VDATE)),’HH24:MI:SS’)
FROM (SELECT MIN(DDATE) VDATE
FROM DEPT
GROUP BY TRUNC(DDATE))

****************************************************************************************************************
Note : Please not do make backups before using these queries and also confirm them yourself or by aother means as
well.
*****************************************************************************************************************
Share

Comments

comments

Tags: , , , ,

Leave a Reply