Est-ce que qqn comprend ce qui ne fonctionne pas dans cette requete Sql sous Access.


TABLE STATISTIQUE
numeroSTATISTIQUE
numeroTYPEDONNEE
nomREGION
codeSCIAN

TABLE ANNEE_STATISTIQUE
numeroSTATISTIQUE
numeroANNEE
moyenne


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
SELECT A11.numeroANNEE AS numeroANNEE, (A11.moyenneANNEE_STATISTIQUE-A113.moyenneANNEE_STATISTIQUE) AS moyenne
FROM ANNEE_STATISTIQUE AS A11, ANNEE_STATISTIQUE AS A113, Statistique AS S11, Statistique AS S113
WHERE S11.nomREGION=region And S113.nomREGION=region And S11.numeroTYPEDONNEE=9 And S11.codeSCIAN='11' And S11.numeroSTATISTIQUE=A11.numeroSTATISTIQUE And S113.codeSCIAN='113' And S113.numeroSTATISTIQUE=A113.numeroSTATISTIQUE And A11.numeroANNEE=A113.numeroANNEE And A11.nombreMoisANNEE_STATISTIQUE=nbMois And A113.nombreMoisANNEE_STATISTIQUE=nbMois
UNION
SELECT  numeroANNEE, SUM(moyenneANNEE_STATISTIQUE) AS moyenne
FROM ANNEE_STATISTIQUE AS AST, STATISTIQUE AS S
WHERE (((S.numeroSTATISTIQUE)=AST.numeroSTATISTIQUE) And nombreMoisANNEE_STATISTIQUE=nbMois And ((S.nomREGION)=region) And ((S.numeroTYPEDONNEE)=1) And (S.codeSCIAN='311' Or S.codeSCIAN='3121'  Or S.codeSCIAN='411'  Or S.codeSCIAN='413'  Or S.codeSCIAN='445'  Or S.codeSCIAN='722')
GROUP BY numeroANNEE
ORDER BY numeroANNEE;

Je sais que cette requete est affreuse!!! :\ Le probleme est que j'ai besoin de faire le code Scian (11 - 133) + 311 + 3121...
C'est pour ca jessaie dunir les deux requete

[Edit] Balises Code powered by Xo, merci d'y penser [/Edit]