Skip to Content
Former Member
Nov 02, 2010 at 08:26 AM

Productwise Monthly Sales by a Customer


Dear Experts,

Can anybody help me how to get the monthly sales qty like April, May ....etc according to Customer wise for a perticular Item.

Any help to modify the existing query

SELECT T1.[ItemName] 'Item Name', T0.[CardName] 'Customer Name', T2.[City], T3.[GroupName] 'Category', SUM(T0.[OutQty]) as 'Sale Qty', SUM(T0.[InQty]) as 'Return Qty', SUM(T0.[OutQty])-SUM(T0.[InQty]) as 'Total Sale.Qty' FROM OINM T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode INNER JOIN OCRG T3 ON T2.GroupCode = T3.GroupCode WHERE T0.[DocDate] >= [%0] and T0.[DocDate] <= [%1] and T0.[ItemCode] = [%2] and T0.[TransType] in ('15', '16', '14') GROUP BY T0.[CardName], T2.[City], T1.[ItemName], T3.[GroupName] order by T1.[ItemName], T3.[GroupName] desc