Bonjour tout le monde,

Voilà mon problème. J'ai une requête initiale qui fonctionne très bien :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
27
28
29
30
SELECT TABCON.TABC_LIBE, N5CLAS.N1CL_CODE, N5CLAS.N2CL_CODE,
sum(ETAT2SYNT.SYNT_NBTOT ),
sum( ETAT2SYNT.SYNT_NBLIE),
N5CLAS.N2CL_CODE
FROM ETAT2SYNT,
N1CLAS,
N2CLAS,
N3CLAS,
N4CLAS,
N5CLAS,
TABCON
WHERE N2CLAS.N1CL_CODE = N1CLAS.N1CL_CODE
and N3CLAS.N1CL_CODE = N2CLAS.N1CL_CODE
and N3CLAS.N2CL_CODE = N2CLAS.N2CL_CODE
and N4CLAS.N1CL_CODE = N3CLAS.N1CL_CODE
and N4CLAS.N2CL_CODE = N3CLAS.N2CL_CODE
and N4CLAS.N3CL_CODE = N3CLAS.N3CL_CODE
and N5CLAS.N1CL_CODE = N4CLAS.N1CL_CODE
and N5CLAS.N2CL_CODE = N4CLAS.N2CL_CODE
and N5CLAS.N3CL_CODE = N4CLAS.N3CL_CODE
and N5CLAS.N4CL_CODE = N4CLAS.N4CL_CODE
and ETAT2SYNT.SYNT_CMAG = TABCON.TABC_CMAG
and ETAT2SYNT.SYNT_CNIV1 = N5CLAS.N1CL_CODE
and ETAT2SYNT.SYNT_CNIV2 = N5CLAS.N2CL_CODE
and ETAT2SYNT.SYNT_CNIV3 = N5CLAS.N3CL_CODE
and ETAT2SYNT.SYNT_CNIV4 = N5CLAS.N4CL_CODE
and ETAT2SYNT.SYNT_CNIV5 = N5CLAS.N5CL_CODE
AND ETAT2SYNT.SYNT_TYPO = 'MDD'
AND N5CLAS.N1CL_CODE = '3'
GROUP BY TABCON.TABC_LIBE, N5CLAS.N1CL_CODE, N5CLAS.N2CL_CODE
et j'aimerais juste afficher tous les TABCON.TABC_LIBE qui sont présents dans la table TABCON (on aura donc des sommes = 0 dans l'affichage quand TABCON.TABC_LIBE n'appartiendra pas à ETAT2SYNT.SYNT_TYPO = 'MDD' ni à N5CLAS.N1CL_CODE = '3'). J'ai essayé de bricoler un truc qui ne fonctionne pas (je vous épargne toutes les jointures).

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
SELECT TABCON.TABC_LIBE, N5CLAS.N1CL_CODE, N5CLAS.N2CL_CODE,
sum(ETAT2SYNT.SYNT_NBTOT ),
sum( ETAT2SYNT.SYNT_NBLIE),
'' AS LIGNE
FROM ETAT2SYNT,
N1CLAS,
N2CLAS,
N3CLAS,
N4CLAS,
N5CLAS,
TABCON
WHERE N2CLAS.N1CL_CODE = N1CLAS.N1CL_CODE
AND ETAT2SYNT.SYNT_TYPO = 'MDD'
AND (N5CLAS.N1CL_CODE = '3'
OR ETAT2SYNT.SYNT_CMAG NOT IN (SELECT SYNT_CMAG FROM ETAT2SYNT))
GROUP BY TABCON.TABC_LIBE, N5CLAS.N1CL_CODE, N5CLAS.N2CL_CODE
La base de données est sous Oracle. Je ne donne pas la version vu que c'est pour un besoin professionnel et que certains clients à qui est destinée la requête n'auront peut être pas la même version que moi.
Il faudrait donc que la requête fonctionne sur toutes les versions d'oracle.

Si quelqu'un a une idée je prend .

En vous remerciant par avance.