The issue I am having here is when I run this query, it gives me duplicate rows as well in the result. I am using these 2 tables . TABLE Receivables has a Unique DOC NUMBER for each Customer ID. Note that Customer ID are Duplicate but Doc Number s are Unique.so that the combination of these 2 fields are not duplicate
In the same way, the 2nd Table RM20201 has also Unique Document Numbers with Customer Ids. I want to show all THOSE records from RECEIVABLE Table only whose Document Numbers (A.DOCNUMBR) are not present in TABLE RM20201, This query shows me the correct data but the result shows duplicate rows after running this query. Can you let me know why I am getting the correct data with duplicate rows?????? will appreciate your help
SELECT * FROM Receivables As A
JOIN RM20201 B
ON A.CUSTNMBR= B.CUSTNMBR
WHERE A.DOCNUMBR <> B.APTODCNM
AND A.DOCNUMBR <> B.APFRDCNM AND A.CURTRXAM <>0