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

Deleting Duplicate records from a table 1

Status
Not open for further replies.

paramit81

Technical User
Dec 3, 2004
11
US
Hello All,
I have 2 different tables having different attributes and attribute names. But they contain alomst the same data just that they have different names for the attributes. Now I want all this data at a common location and So I try to append the data putting similar field values from one table into another table. The problem I face now is that 2 records have same data related to the same person. I have fields for Last_Name, First_Name and Middle_Name in each of these 2 tables. I want unique records for a single person. So how to delete the duplicates from the common table. I can find out the duplicates using the duplicate query, But how can I delete other records leaving just 1 unique record.
I wud appreciate the help.
 
Create a temp table

Select all distinct records from you old table into the new table.
Delete all records from old table.
Insert from new table into old table.

Just one way. If using SQL Server you can also setup a unique key where you ignore duplicates error, and then following the steps above but ignore the "distinct" keyword.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top