1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| --Si tu veux utiliser mon code, tu supprimes de la
with arrivee as (
select '1' as ID,'Alice' as nom,'Lundi' as jour,'11' as heure from dual union
select '2','Alice','Lundi','13' from dual union
select '3','Alice','Mardi','11' from dual union
select '4','Celine','Mercredi','14' from dual union
select '5','Celine','Mercredi','13' from dual union
select '6','Celine','Jeudi','14' from dual union
select '7','Maud','Vendredi','15' from dual union
select '8','Maud','Samedi','15' from dual union
select '9','Maud','Samedi','16' from dual
)--jusque la
select A.nom,
A.jour,
B.heure
from ( select nom,
max(jour) keep (dense_rank first order by nb_jour desc) as jour
from ( select nom,
jour,
count(*) nb_jour
from arrivee
group by nom, jour
)
group by nom
) A
inner join (select nom,
max(heure) keep (dense_rank first order by nb_heure desc) as heure
from ( select nom,
heure,
count(*) nb_heure
from arrivee
group by nom, heure
)
group by nom
) B on A.nom = B.nom |
Partager