on 07-21-2016 5:26 PM
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]')
Hi Roy Bright Try this
SELECT T0.CardCode, T0.CardName, T0.DocDate, T1.ItemCode, T1.Dscription, sum (T1.Quantity) as'Quantity'
, sum (T1.LineTotal) as 'Amount', 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]')
Group by T0.CardCode, T0.CardName, T0.DocDate, T1.ItemCode, T1.Dscription, T3.SlpName
Have a good day
Jamil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You mean you need subtotal by Sales Employee, in this case create query with temp tables and insert the values and insert the subtotal by sales employee and bring the final result with all values
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Have you tried with standard sales analysis report?
1. Try with PIVOT function to get total for individual sales emo total
OR
2. You have to sum for each employee in above query
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.