Good day experts,
I have a query below that is returning multiple rows, and not summing the quantity as expected.
SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName],
count(T1.[Quantity]) [Total Cases],
T0.DocTotal - T0.VatSum - T0.DiscSum [Inv. Value (ex VAT)], T2.[TrnspName], T0.[Weight]/1000[Weight (kg)] FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OSHP T2 ON T0.TrnspCode = T2.TrnspCode WHERE T0.[DocDate] >=[%0] AND T0.[DocDate] <=[%1] AND T1.[WhsCode] =[%2] GROUP BY T1.[Quantity], T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T1.[LineTotal], T2.[TrnspName], T0.[Weight], T0.DocTotal, T0.VatSum, T0.DiscSum ORDER BY T0.DocNum
Please can you point me in the right direction to correct?
Thanks in advance,
Kiran