Oracle
 sql >> Base de Dados >  >> RDS >> Oracle

Calculando a média de uma lista de TIMESTAMP(6) WITH TIME ZONE vezes


Use o AVG função
SELECT avg(cast(lastprocesseddate as date)-cast(importeddate as date))
FROM feedqueueitems 
WHERE eventid = 2213283 
ORDER BY written DESC;

No banco de dados com o fuso horário +1 para data importada e data processada é UTC
SELECT avg(cast(cast(lastprocesseddate as timestamp with time zone) at time zone '+01:00' as date)-cast(importeddate as date))
FROM feedqueueitems 
WHERE eventid = 2213283 
ORDER BY written DESC;