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 |
|
yuchenchen
Starting Member
4 Posts |
Posted - 2009-09-03 : 09:17:14
|
| Hi,I want to identify the duplicate data in my database. For example, my data base is like this:ID NUMBERA 1A 1 A 2A 3A 4B 4B 5B 5 B 5B 6C 6C 1C 2C 8C 8I want to identify the data with red color since it identify the "Number" first and then match with the "ID". However the programming i wrote right now show the duplicate data with green colorID NUMBERA 1A 1A 2A 3A 4B 4B 5B 5 B 5B 6C 6C 1C 2C 8C 8so, how should i write in order to identify the duplicate data in NUMBER and also can stick within one "ID"?Thank you |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-09-03 : 09:19:36
|
| select ID,NUMBER from your_tablegroup by ID,NUMBERhaving count(*)>1MadhivananFailing to plan is Planning to fail |
 |
|
|
yuchenchen
Starting Member
4 Posts |
Posted - 2009-09-03 : 09:53:53
|
| sorry but the result is not what i am looking for.The programming is just like what I wrote. but thank you for your inputs. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-09-03 : 10:01:51
|
| select t1.* from your_table as t1 inner join(select ID,NUMBER from your_tablegroup by ID,NUMBERhaving count(*)>1) as t2 on t1.id=t2.id and t1.number=t2.numberMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|