[quote=&quot;Toontoon&quot;:x8iwpg70]Il faut faire des sum et compter 1 quand chacune de des coniditions sont remplies.

Tu peux pas homogiénéiser tes requêtes pour qu'on voit clairement les différences dans tes clauses where ?

Les jointures doivent être identiques, sinon c'est impossible ce que tu demandes.[/quote:x8iwpg70]

Requête 1
[code:x8iwpg70]select
SERVICE&#46;NOM,
count(distinct p&#46;prelevement_id) as Nb_prlv

from
PRELEVEMENT p left join ECHANTILLON e on e&#46;PRELEVEMENT_ID = p&#46;PRELEVEMENT_ID, ECHANTILLON_TYPE, SERVICE, ETABLISSEMENT

where
SERVICE&#46;ETABLISSEMENT_ID = ETABLISSEMENT&#46;ETABLISSEMENT_ID
and
SERVICE&#46;SERVICE_ID = p&#46;SERVICE_PRELEVEUR_ID
and
p&#46;PRELEVEMENT_ID = e&#46;PRELEVEMENT_ID
and
e&#46;ECHANTILLON_TYPE_ID = ECHANTILLON_TYPE&#46;ECHANTILLON_TYPE_ID
and
ECHANTILLON_TYPE&#46;TYPE like 'TI%'
and
e&#46;EMPLACEMENT_ID is not null
and
date_format(e&#46;date_stock,'%Y') in ('2014')
and
date_format(e&#46;date_stock,'%m') in ('01','02','03','04','05','06')
and
ETABLISSEMENT&#46;NOM like 'CHU J%'

group by
SERVICE&#46;NOM[/code:x8iwpg70]

Requête 2

[code:x8iwpg70]select
SERVICE&#46;NOM,
count(distinct p&#46;PRELEVEMENT_ID) as nb_prlv_30

from 
PRELEVEMENT p left join ECHANTILLON e on e&#46;PRELEVEMENT_ID = p&#46;PRELEVEMENT_ID, ECHANTILLON_TYPE, SERVICE, ETABLISSEMENT

where
e&#46;ECHANTILLON_TYPE_ID = ECHANTILLON_TYPE&#46;ECHANTILLON_TYPE_ID
and
SERVICE&#46;ETABLISSEMENT_ID = ETABLISSEMENT&#46;ETABLISSEMENT_ID
and
SERVICE&#46;SERVICE_ID = p&#46;SERVICE_PRELEVEUR_ID
and
ECHANTILLON_TYPE&#46;TYPE like 'TI%'
and
left(p&#46;CODE,3) = '001'
and 
date_format(e&#46;date_stock,'%Y') = '2014'
and
date_format(e&#46;date_stock,'%m') in ('01','02','03','04','05','06')
and
date_format(p&#46;DATE_ARRIVEE,'%T') not in ('00&#58;00&#58;00')
and
date_format(p&#46;DATE_PRELEVEMENT, '%T') not in ('00&#58;00&#58;00')
and
timestampdiff (minute, p&#46;DATE_PRELEVEMENT, p&#46;DATE_ARRIVEE) &gt; '30'

Group by
SERVICE&#46;NOM[/code:x8iwpg70]