select rownum as classement, req.* from (
select annee,to_char(n_coureur) as n_coureur, nom, prenom, sum(total_seconde)+ difference as temps_total from vt_coureur
left join vt_temps using (n_coureur)
left join vt_temps_difference using (n_coureur,annee)
where annee=2005
and n_coureur not in (
select n_coureur from vt_abandon
where annee=2005
)
and n_coureur in(
select n_coureur from vt_parti_coureur
where upper(valide) != 'R'
and annee=2005)
group by (n_coureur, nom, prenom, difference,annee)
UNION
select annee, '------' as n_coureur, substr(nom,0,2) || '----' as nom, substr(prenom,0,2) || '----' as prenom, sum(total_seconde)+ difference as temps_total from vt_coureur
join vt_temps using (n_coureur)
join vt_temps_difference using (n_coureur,annee)
where annee=2005
and n_coureur in(
select n_coureur from vt_parti_coureur
where upper(valide) = 'R'
and annee=2005)
group by (n_coureur, nom, prenom, difference,annee)
order by temps_total) req;