‎2021 Sep 05 12:20 PM
I need a query to get sales-return of all customers. For this I use the following query that shows no result
SELECT T0.[CardCode], sum(T0.[DocTotal]-T1.[DocTotal]) FROM OINV T0 INNER JOIN ORIN T1 ON T0.[DocEntry] = T1.[AnnInvDecR] WHERE T0.[CANCELED] ='n' AND T1.[CANCELED] = 'n' GROUP BY T0.[CardCode]
Then I change it to the following, it shows wrong result
SELECT T0.[CardCode], sum(T0.[DocTotal]-T1.[DocTotal]) FROM OINV T0 INNER JOIN ORIN T1 ON T0.[CardCode] = T1.[CardCode] WHERE T0.[CANCELED] ='n' AND T1.[CANCELED] = 'n' GROUP BY T0.[CardCode]
Please suggest the correction.
‎2021 Sep 08 11:30 AM
please share structure of table ORIN and OINV and foreign key relationship between these table Also pleasw specify sales-return data type.
relationship between table(ORIN and OINV) is one to one or realationship between table(ORIN and OINV) is one to many
‎2021 Sep 13 11:49 AM
‎2021 Sep 13 1:35 PM