I have a query which is repeating data in case multiple checks are used for payment;
SELECT DISTINCT T0.[DocDate], T1.[DueDate], T1.[CheckNum]as 'Cheque', T1.[BankCode] AS 'Bank Code' , T1.[Branch], T1.[AcctNum], T2.[AcctCode],T2.[Descrip], T2.[SumApplied], T0.[DocTotal] FROM OVPM T0 INNER JOIN VPM1 T1 ON T0.DocNum = T1.DocNum INNER JOIN VPM4 T2 ON T0.DocNum = T2.DocNum WHERE T0.[DocType] = 'A' and T0.[DocDate] >=[%0]
T0.[DocDate] <=[%1] and T0.[DocNum] = [%3]
Let's say I selected doc type as accounts and at row level i selected 9 accounts. While on the payment means, i used 9 different checks for the payment. Now while viewing the data from this query, its repeating the data 81 times. How do i get to show only 9 accounts and 9 check number in the query? Please assist.