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 |
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-06-14 : 01:29:42
|
| Dear experts,I've one table...there are somany repeated rows.i can find the distinct rows using distinct command.but how can i find the repeated rows?please guide me in this regard.VinodEven you learn 1%, Learn it with 100% confidence. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-14 : 01:38:31
|
| [code]select col1, col2, ..., colnfrom tablegroup by col1, col2, ..., colnhaving count(*) > 1[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-06-14 : 01:46:00
|
| thank you harshVinodEven you learn 1%, Learn it with 100% confidence. |
 |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-06-14 : 02:18:33
|
| Dear harsh,I'm not getting all the records....suppose there are 5 records having same data, then the five records should be displayed...VinodEven you learn 1%, Learn it with 100% confidence. |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-14 : 02:23:03
|
What's the use of displaying five records if all of them have exactly same data.Anyway, it can be done like this:select t1.* from table t1 JOIN(select col1, col2, ..., colnfrom tablegroup by col1, col2, ..., colnhaving count(*) > 1) t2On t1.col1 = t2.col1 and t1.col2 = t2.col2 .... and t1.coln = t2.coln Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-06-14 : 05:32:15
|
| Thank you harsh....actually for practice purpose i've asked the queryVinodEven you learn 1%, Learn it with 100% confidence. |
 |
|
|
|
|
|
|
|