I have the following query which returns duplicate lines. I know why, the invoice has multiple lines with the same ItemCode. How do I edit the query to return only one line?
Thanks
SELECT T3.[DocDate], T3.[CardName], T0.[Debit] + T0.[Credit] AS 'Value'
FROM JDT1 T0 INNER JOIN OJDT T1 ON T0.[TransId] = T1.[TransId]
INNER JOIN OPCH T3 ON T1.[TransId] = T3.[TransId]
INNER JOIN PCH1 T2 ON T3.[DocEntry] = T2.[DocEntry]
WHERE T3.[DocDate] >= '2022-01-01' AND T2.[ItemCode] = '700000' AND T0.[ShortName] = '5010-3040'
ORDER BY T3.[DocDate]