Bonjour,

Quelqu'un peut m'aider ?
J'ai un problème avec une requête, elle ne m'affiche que les champs renseignés : si un champs est null elle ne l'affiche pas, hors je voudrais qu'elle affiche 0 quand c'est null.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 SELECT	COUNT(DISTINCT E.iets)  FROM r_etablissement E, r_histo_etats_ets H1, r_enseignement_ets C
WHERE	E.iets = H1.iets
AND	E.iets = C.iets
AND	C.icat_agr IN (SELECT icat_agr FROM  r_cat_agr ) 
AND	(C.date_deliv_ets <= '10/10/2009' OR C.date_deliv_ets IS NULL)
AND	H1.ietat IN (2,3,4,7)
AND	H1.date_effet_ets IN (SELECT MAX(date_effet_ets) FROM r_histo_etats_ets H2
WHERE	H1.iets = H2.iets
AND	H2.date_effet_ets <= '10/10/1990' )
AND  E.idep = '01' group by icat_agr;
Le résultat :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
COUNT(DISTINCT E.iets) 
60
114
7
4
7
16
72
1
114
Il manque un champ 0 elle ne me l'affiche pas.