How to calculate average daily time of the Start_Time and End_Time fields

I am using ORACLE 11 G on Red Hat Linux, I have calculated the average daily time of multiple transactions for each day. The followign is the querry that shows the difference between the fields end_time start_ time and time.

Select TRIP_LOAD_STARTED AS START_TIME, TRIP_LOAD_ENDED'RE END_TIME.

ceil ((TRIP_LOAD_EDDT-TRIP_LOAD_STDT) * 1440) "time difference Bw Start and End.
of GATE2GATE_ACTIVITY_VW
Where TRIP_LOAD_STARTED > = February 1, 14 '
AND TRIP_LOAD_ENDED < 3 February 14 '
ORDER BY TRIP_LOAD_STARTED;

The querry above gives me the result as follows:

Start_Time End_Time time Diff bw begins and ends

1 FEBRUARY 14 FEBRUARY 1, 14 18

1 FEBRUARY 14 FEBRUARY 1, 14 18

1 FEBRUARY 14 FEBRUARY 1, 14 18

1 FEBRUARY 14 FEBRUARY 1, 14 18

1 FEBRUARY 14 FEBRUARY 1, 14 18

1 FEBRUARY 14 FEBRUARY 1, 14 18

1 FEBRUARY 14 FEBRUARY 1, 14 12

FEBRUARY 2, 14 2 FEBRUARY 14 29

FEBRUARY 2, 14 2 FEBRUARY 14 29

FEBRUARY 2, 14 2 FEBRUARY 14 29

FEBRUARY 2, 14 2 FEBRUARY 14 29

FEBRUARY 2 FEBRUARY 2, 14 14 19

FEBRUARY 2 FEBRUARY 2, 14 14 19

FEBRUARY 2 FEBRUARY 2, 14 14 19


It shows two dates for which I want to get the average duration in minutes for each group to date by the start time.


I use the following querry that probably gives me the average two days mentioned in where clause


Select the floor (avg ((TRIP_LOAD_STARTED-TRIP_LOAD_ENDED) * 1440)) 'average of Minutes of time.

of gate2gate_activity_vw

Where TRIP_LOAD_STDT > = February 1, 14 '

AND TRIP_LOAD_STDT < 3 February 14 ';

Average duration in Minutes

29

Can someone help me to a daily average time calculated between start and end.

Kind regards

mhamidch

Is that what you want:

SELECT trunc (TRIP_LOAD_STARTED), trunc (TRIP_LOAD_ENDED).

floor (avg (ceil ((TRIP_LOAD_ENDED-TRIP_LOAD_STARTED) * 1440))) Diff

OF GATE2GATE_ACTIVITY_VW

WHERE TRIP_LOAD_STARTED > = to_date('01/FEB/2014','dd/MON-YYYY')

AND TRIP_LOAD_ENDED<>

Trunc GROUP (TRIP_LOAD_STARTED), trunc (TRIP_LOAD_ENDED)

Always the example of create table and insert statements to verify the results and use the to_date with date format function.

Post edited by: Elya

Tags: Database

Similar Questions

Maybe you are looking for