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 Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete Duplicate Records fro two fields

Status
Not open for further replies.

vangundy

Programmer
Jan 29, 2005
38
CA
How can I delete records where the FName and LName are duplicate?

Ex:

LName FName

Smith Joe
Smith John
Smith Joe
Brown Dennis


As you can see there is a duplicate for LName and FName. The final Outcome shoudl be:

LName FName

Smith Joe
Smith John
Brown Dennis
 
Hi
This may help:
Delete Duplicates (Save One From Each Group)
faq701-5721
 
Hopefully your table contains a PrimaryKey:
DELETE FROM yourTable
WHERE [PK field] Not In (SELECT Max([PK field]) As x
FROM yourTable GROUP BY LName,FName);

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Actually I do not have a unique... I am taking an extract from another system and the way there backend is created there is no unique key..... (!!!)
 
I am taking an extract from another system
How are you doing that ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I am using a macro to import the csv file into my table... I do not have aunique key... when I try to move the data usinf distinct and into a new table I get a msg that this field is to small..... when using memo fields
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top