1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| SQL> with table_pref_voiture (Marque,Couleur,Moteur,Poids,Cylindre,tours,temps_tours) as (
2 select 'Ferrari','Rouge','V6','1,5T',2300,'LAP1','1:12:768' from dual union all
3 select 'Ferrari','Rouge','V6','1,5T',2300,'LAP2','1:17:478' from dual union all
4 select 'Ferrari','Jaune','V8','1,6T',2800,'LAP1','1:0:568' from dual union all
5 select 'Ferrari','Jaune','V8','1,6T',2800,'LAP2','1:09:988' from dual
6 )
7 select Marque,Couleur,Moteur,Poids,Cylindre,
8 max(case when tours = 'LAP1' then temps_tours end) as LAP1,
9 max(case when tours = 'LAP2' then temps_tours end) as LAP2
10 from table_pref_voiture
11 group by Marque,Couleur,Moteur,Poids,Cylindre
12 /
MARQUE COULE MO POID CYLINDRE LAP1 LAP2
------- ----- -- ---- ---------- -------- --------
Ferrari Rouge V6 1,5T 2300 1:12:768 1:17:478
Ferrari Jaune V8 1,6T 2800 1:0:568 1:09:988
SQL> |
Partager