I have this query:
SELECT VIAGEM.IDVOOREGULAR COD_VOO_REGULAR,
VIAGEM.DATAPARTIDA DATA,
VOO.ORIGEM,
VOO.DESTINO,
(((EXTRACT (DAY FROM (DATACHEGADA-DATAPARTIDA))*24*60*60 +
EXTRACT (HOUR FROM (DATACHEGADA-DATAPARTIDA))*60*60 +
EXTRACT (MINUTE FROM (DATACHEGADA-DATAPARTIDA))*60)/60)-VOO.DURACAO) ATRASO
FROM VIAGEM,
VOO_REGULAR,
VOO
WHERE VIAGEM.IDVOOREGULAR=VOO_REGULAR.ID AND
VOO_REGULAR.IDVOO=VOO.ID;
and this result:
And I want to get just the biggest ATRASO
from each group of COD_VOO_REGULAR
.
How can I do it?