Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query to display only duplicate entries

Status
Not open for further replies.

btween

Programmer
Aug 7, 2003
338
US
I have a project that I need to be able to list duplicate entries from.

The following query lists all the members.

Can you please help me rewrite this query so it only displays records where FirstName and LastName are the same,
so duplicate or triplicate records... based on that criteria.

here is the query:
Code:
strSQL =  "SELECT FirstName, LastName, Trcode, Transaction_Date, OrderID "
strSQL = strSQL & "FROM Firstcup INNER JOIN Orders"
strSQL = strSQL & " ON Firstcup.SSN = Orders.OrderID " 
strSQL = strSQL & " ORDER BY Transaction_Date DESC"
As far as the sorting I would need to sort these by Transaction_date first and the name of the individual second.

In other words if there were 2 John Smiths, one with a Transaction_date of 10/1/2004 and the other with a Transaction_date of 11/12/2004
and there were 2 Jane Turrows one with a Transaction_date of 06/07/2004 and the second with a Transaction_date of 11/15/2004 the recordset would print:

Jane Turrow 11/15/2004
Jane Turrow 06/07/2004
John Smith 11/12/2004
John Smith 10/1/2004

thanks for your help
 
The type of duplication you're looking for determines how the query needs to be written.

Are you trying to list out the order dates for members who have placed multiple orders? This is not quite the same as listing out orders from members whose names are the same.

In the first case, people with mutiple orders should always have the same SSN each time they order. In the second case, they maybe be totally different people who just happen to have the same name. Their orders may not really be duplicated but the names on the orders are.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top