1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| WITH interv AS
(
select 1 as iid, 'ABC' as inte, 'decidée' as typetache from dual union all
select 2 , 'DEF' , 'decidée' from dual union all
select 3 , 'DEF' , 'non-decidée' from dual union all
select 4 , 'GHI' , 'non-decidée' from dual union all
select 5 , 'JKL' , 'decidée' from dual union all
select 6 , 'JKL' , 'decidée' from dual
)
select count(distinct inte) as cdi,
count(case when typetache = 'decidée' then 1 end) as cn1,
count(distinct case when typetache = 'decidée' then inte end) as cn2
from interv;
CDI CN1 CN2
4 4 3 |