Hi Francis,
Try this
SELECT T0.DocDate AS 'Date Issued', T0.CardName as 'Business Partner',
T2.Dscription as 'Invoice Details', T2.AcctCode as 'GL Account Details',
T0.DocNum as 'Payment No.', SUM(T4.SumApplied) as 'Inflows', T1.SumApplied as 'Total Payment'
from OVPM T0
LEFT JOIN (SELECT * FROM VPM2 WHERE InvType=18) T1 on T0.DocNum=T1.DocNum
LEFT JOIN PCH1 T2 on T1.DocEntry=T2.DocEntry
INNER JOIN (SELECT * FROM OPCH WHERE DocType='S') T3 on T2.DocEntry=T3.DocEntry,
(select * from VPM4 where AcctCode = '<pls. place petty cash account here>') T4
where T0.CashAcct = '<pls. place petty cash account here>'
group by T0.DocDate, T0.CardName, T2.Dscription, T2.AcctCode, T0.DocNum, T1.SumApplied
but I would expect the inflows to have only one data since I sum all inflows here. Is this correct?
ALAIN