Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hotfirenet/94872c61a4ce86dc045eec2c2a031b5b to your computer and use it in GitHub Desktop.
Save Hotfirenet/94872c61a4ce86dc045eec2c2a031b5b to your computer and use it in GitHub Desktop.
SELECT SUM(A.DL_Qte) AS 'Qte', SUM(A.DL_MontantHT) AS MontantHT, MONTH(A.DO_Date) AS mois, YEAR(A.DO_Date) AS annee, A.AR_Ref, C.TYPECLIENT, E.LI_Pays
FROM dbo.F_DOCLIGNE A
INNER JOIN dbo.F_DOCENTETE D ON D.DO_Piece = A.DO_Piece
INNER JOIN dbo.F_LIVRAISON E ON E.LI_No = D.LI_No
INNER JOIN [dbo].[F_ARTICLE] B ON B.AR_Ref = A.AR_Ref
INNER JOIN [dbo].[F_COMPTET] C ON C.CT_Num = A.CT_Num
WHERE A.DO_Type IN (6, 7) AND YEAR(A.DO_Date) >= 2021 AND B.MARQUE IN ('AQARA')
GROUP BY MONTH(A.DO_Date), YEAR(A.DO_Date), A.AR_Ref, C.TYPECLIENT, E.LI_Pays
ORDER BY 4,3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment