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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2000-11-25 : 12:19:07
|
Tom writes "I have a table that gets data merged into in from laptop computers. Any new records that were added on the different laptops can have the same auto id field. This auto Id is used to generate a bar code for the product.
We need to be able to find these duplicate Id's so we can deal with them. The table does allow the fields to be duplicated so there are no errors when the data is merged. Anyway it is very easy to find the duplicates with...
Select ID.products From Products Group by ID.Products Having count(ID.Products) > 1
The problem is that it is valid to have the ID duplicated in the table, because many items actualy (I don't know why) have the same model number and thus have the same bar code (generated from the auto ID field). The reasion more than one item can have the same model and ID number is that they are the same product except for color and other minor factors. For some reason these variations were not given their own unique model and Id numbers.
So just preforming the above select statment will find alot of duplicates, most of which are valid. The ones that are not valid are where the ID and Model are duplicated but do not match. So if on one system a new product was added it is assigned a ID number, but the same ID number will get assigned to another model on a different system. When they are merged we have different models with the same ID.
I know this is a real mess, but I can change the whole system. The best I can do is run a procedure everytime the data is merged to find duplicate ID numbers that have different model numbers. But I am stuck. Any Ideas?" |
|
|
|
|
|