MySQL Forums
Forum List  »  Newbie

Query is duplicating the results
Posted by: John Noble
Date: November 19, 2018 06:10AM

Hi folks,

I have a query...

SELECT receipts.receiptNo, receipts.invNum, receipts.invoiceDate, receipts.receiptDate, receipts.payInvoiceDate, receipts.invoiceAmount, receipts.allocationAmount, receipts.customerID, receipts.receiptAmount, receipts.docType, receipts.comment, receipts.paymentNo, receipts.creditDaysTaken, receipts.dayBookNo,
customers.name,
salesLedger.invoiceDate, salesLedger.payable, salesLedger.balance, salesLedger.accountID

FROM receipts
INNER JOIN salesLedger
ON receipts.paymentNo = salesLedger.paymentNo
INNER JOIN customers
ON receipts.customerID = customers.customerID


WHERE receipts.paymentNo = p_paymentNo and receipts.customerID = p_customerID;

The problem is if there are 2 records in salesledger that have the same paymentNo then the query return 2 sets of the same data from the receipts table. I want only one set.

Can anyone advise ?

John

Options: ReplyQuote


Subject
Written By
Posted
Query is duplicating the results
November 19, 2018 06:10AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.