Skip to Content
0
Jul 21, 2016 at 04:26 PM

Sales by date and employee

35 Views

Hi guys - i have the following query so we can show sales by date range and employee - is there a way that I can group these together so that it groups all of the sales by employee showing one total only?

SELECT T0.CardCode, T0.CardName, T0.DocDate, T1.ItemCode, T1.Dscription, T1.Quantity, T1.LineTotal, T3.SlpName

FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode

INNER JOIN OSLP T3 ON T0.[SlpCode] = T3.[SlpCode]

WHERE (T0.DocDate>='[%0]' and T0.DocDate<='[%1]')

Select '','',Null, '','Total',Null, Sum(T1.LineTotal)

FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry

INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode

WHERE (T0.DocDate>='[%0]' and T0.DocDate<='[%1]')