Eu fiz um select que me traz os dados que por base eu quero tirar a média;
SELECT
ate.cd_atendimento atendimento
,ate.hr_atendimento Entrada
,mov.hr_mov_hosp Consulta
from
dbamv.atendime ate, dbamv.mov_hosp mov
where
ate.cd_atendimento = mov.cd_atendimento AND
ate.cd_ori_ate = '14' and
ate.tp_atendimento = 'U' and
mov.cd_tip_situacao = '1' and
ate.hr_atendimento > to_date('01.03.2011 08:00:00', 'dd/mm/yyyy HH24:MI:SS') and
ate.hr_atendimento < to_date('05.05.2011 09:00:00', 'dd/mm/yyyy HH24:MI:SS')
ORDER BY ate.cd_atendimento
Atendimento Entrada Consulta
171373 2011-03-01 08:16:25 2011-03-01 08:31:41
171374 2011-03-01 08:27:21 2011-03-01 08:28:23
171375 2011-03-01 08:29:10 2011-03-01 08:33:50
171376 2011-03-01 08:36:55 2011-03-01 08:44:41
171377 2011-03-01 08:38:11 2011-03-01 08:41:44
171378 2011-03-01 08:40:59 2011-03-01 08:48:35
171379 2011-03-01 08:53:34 2011-03-01 08:58:19
171380 2011-03-01 08:57:20 2011-03-01 10:05:16
171381 2011-03-01 08:57:38 2011-03-01 10:04:49
171382 2011-03-01 09:00:53 2011-03-01 09:03:54
171383 2011-03-01 09:03:34 2011-03-01 09:15:44
171384 2011-03-01 09:59:04 2011-03-01 10:05:27
171385 2011-03-01 10:01:43 2011-03-01 10:04:15
...
Obrigado.