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
|
> with
2 action
3 as
4 (select 'TITI' nom, date '2008-01-12' dt , 'type1' type from dual union all
5 select 'TATA' , date '2008-02-12' , 'type1' type from dual union all
6 select 'TUTU' , date '2008-03-12' , 'type1' type from dual union all
7 select 'TOTO' , date '2008-05-12' , 'type1' type from dual union all
8 select 'TITI' , date '2009-01-12' , 'type1' type from dual union all
9 select 'TATA' , date '2009-02-12' , 'type1' type from dual union all
10 select 'TUTU' , date '2010-03-12' , 'type1' type from dual union all
11 select 'TOTO' , date '2011-04-12' , 'type1' type from dual union all
12 select 'TITI' , date '2021-05-12' , 'type1' type from dual )
13 SELECT nom, Type,
14 MIN(Dt) AS Date_Min,
15 MAX(Dt) AS Date_Max
16 FROM ACTION
17 GROUP BY nom, Type
18 order by nom;
NOM TYPE DATE_MIN DATE_MAX
---- ----- --------- ---------
TATA type1 12-FEB-08 12-FEB-09
TITI type1 12-JAN-08 12-MAY-21
TOTO type1 12-MAY-08 12-APR-11
TUTU type1 12-MAR-08 12-MAR-10 |