View Full Version : How to remove DUPLICATES


jessjenn
09-03-2004, 08:01 PM
I would like to remove duplicates from the following query. I would like it to display only one record depending on the InvoiceID. So only show one unique record based on Invoices.InvoiceID.

Thanks!

SELECT DISTINCT Invoices.InvoiceID, Invoices.CustomerID, InvoiceDetails.InvoiceDetailID, Invoices.InvoiceDate
FROM InvoiceDetails INNER JOIN Invoices ON InvoiceDetails.InvoiceID = Invoices.InvoiceID WHERE (((Invoices.InvoiceDate) Between #8/1/2004# And #8/31/2004#) AND ((InvoiceDetails.DeliverBy)=0)) ORDER BY Invoices.InvoiceID;

raskew
09-04-2004, 03:12 PM
JessJenn -

Give it some thought. You're running a one-to-many relationship here (Invoices.* on the one-side, InvoiceDetails.* on the many-side). Which InvoiceDetails.* do you want to see? How do you differentiate?

Bob