Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Merging many tables based on priority

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-09-16 : 12:22:56
Motter writes "I have 3 or more tables that have the same schema. Each table has an attribute say, namekey, that is not unique. I need to remove all duplicate namekeys in table 1 and then take out all namekeys from table 2 that are in table 1. Then take out all namekeys from table 3 that are in table 2 and so on until I have a single unique namekey row across all tables. the other fields associated with the namekey need to be present but it does not matter what their actual values are. I am trying to do this programmatically using VB but I am having no luck. The following is some pseudo code.

for first table
delete all duplicates with namekey leaving only one unique namekey
Next

For table2 to tablen
delete all rows with namekey from table(i) where namekey exists in table(i-1)
Next

Two questions that would help me out a lot if I can get an answer ( if there is one other than 'you can't do it').
1. How do I get rid of duplicate rows in a
   

- Advertisement -