Bonjour,
J’ai deux requêtes :
1ére requêtes : Req_Union
Resultat Exemple :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 SELECT ARTICLES.CODE_ARTICLE AS Code, ARTICLES.LIBELLE AS Libelle, SUM(ENTREES_STOCKAGE.QUANTITE_ART_STOCKE) AS SommeDeQUANTITE_ART_STOCKE FROM ARTICLES LEFT JOIN ENTREES_STOCKAGE ON ARTICLES.CODE_ARTICLE = ENTREES_STOCKAGE.CODE_E_ARTICLE GROUP BY ARTICLES.CODE_ARTICLE, ARTICLES.LIBELLE UNION ALL SELECT ARTICLES.CODE_ARTICLE, ARTICLES.LIBELLE, SUM(-1*[QUANTITE_ART_DESSTOCKE]) AS Expr1 FROM ARTICLES INNER JOIN SORTIES_STOCKAGE ON ARTICLES.CODE_ARTICLE = SORTIES_STOCKAGE.CODE_E_ARTICLE GROUP BY ARTICLES.CODE_ARTICLE, ARTICLES.LIBELLE
------------------------------------------------------ ! Code ! Libellé ! SommeDeQUANTITE_ART_STOCKE ! ------------------------------------------------------ ! Ref001 ! xxxxxx1 ! 500 ! ! Ref001 ! xxxxxx1 ! -20 ! ! Ref002 ! xxxxxx2 ! 300 ! ! Ref002 ! xxxxxx2 ! -80 !
2ème Requêtes : Req_Afiche
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 SELECT Req_Union.CODE_ARTICLE AS CODE, Req_Union.LIBELLE AS LIBELLE, SUM(Req_Union.SommeDeQUANTITE_ART_STOCKE) AS SommeQte FROM Req_Union GROUP BY Req_Union.CODE_ARTICLE, Req_Union.LIBELLE HAVING (((SUM(Req_Union.SommeDeQUANTITE_ART_STOCKE)) IS NOT NULL)) ORDER BY CODE_ARTICLE
Resultat Exemple :
------------------------------------------------------ ! CODE ! LIBELLE ! SommeQte ! ------------------------------------------------------ ! Ref001 ! xxxxxx1 ! 480 ! ! Ref002 ! xxxxxx2 ! 220 !
La question c’est comment faire pour avoir une seule requête ?
Merci
Partager