Hi Experts,
I have written below query and in this query I want to add two more columns for Cumulative Month's (Qty and Basic Value), Please help
SELECT T4.[Segment_1] AS 'Division', T3.[ItmsGrpNam] AS 'Type', Sum (T1.[Quantity] * T1.NumPerMsr) AS 'Qty in Ltrs', Sum(T1.[LineTotal]) AS 'Basic Value'
FROM [NPL_N02_LIVE].DBO.ODLN T0
INNER JOIN [NPL_N02_LIVE].DBO.DLN1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN [NPL_N02_LIVE].DBO.OITM T2 ON T1.ItemCode = T2.ItemCode
INNER JOIN [NPL_N02_LIVE].DBO.OITB T3 ON T2.ItmsGrpCod = T3.ItmsGrpCod
INNER JOIN [NPL_N02_LIVE].DBO.OACT T4 ON T0.CtlAccount = T4.AcctCode
INNER JOIN [NPL_N02_LIVE].DBO.OCRD T5 ON T0.CardCode = T5.CardCode
INNER JOIN [NPL_N02_LIVE].DBO.OCRG T6 ON T5.GroupCode = T6.GroupCode
WHERE DateDiff(dd,T0.CreateDate,GetDate()) = '1' And T0.[DocType] = 'I' And T5.GroupCode not in('116', '119', '176', '177', '180', '184', '187', '120', '121', '121', '122', '123', '124', '125', '126', '127', '128', '129') And T3.ItmsGrpCod not in('120', '121', '122', '123', '124', '125', '126', '127', '128', '129') GROUP BY T4.[Segment_1], T3.[ItmsGrpNam] ORDER BY T4.[Segment_1]
Thanks & Regards,
Rahul Goja