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 - 2002-12-19 : 09:26:54
|
| Henry Takawir writes "I have a table called GenMaster and I would not like to delete the records which contai duplicates. I would just like to display the first record of the dupicates. The main Problem is that Distinct can not work for duplicates because the other fields are different. It is just one field that has the same value." |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2002-12-19 : 09:33:56
|
| GROUP BY all fields except for you primary key, in which you can take the MIN() or MAX() or whatever you like.SELECT Min(Key) as Key, field1, field2, ...FROMTableGROUP BY field1, field2, ....- Jeff |
 |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2002-12-19 : 09:38:02
|
| There are some comprehensive articles on "deleting duplicates" on sqlteam - the first article listsseveral techniques for locating duplicates - one of them could be adapted to your situation. Take a look at [url]http://www.sqlteam.com/item.asp?ItemID=3331[/url]Sam |
 |
|
|
|
|
|