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 |
shah
Starting Member
5 Posts |
Posted - 2007-06-14 : 04:22:01
|
Hi,i need help regarding how to select the replicate values from tablei have a table which consistsno name1 saam2 john3 saam4 saam5 john6 smith7 shelly8 smithfrom this i just want to get the repeated values i.esno name1 saam2 john3 saam4 saam5 johncan any one help out how to get thisi have tried with group by n having clauses but no result.thanx in advanceshah |
|
pbguy
Constraint Violating Yak Guru
319 Posts |
Posted - 2007-06-14 : 04:34:22
|
Select * from <table> where name in(Select name from <table>group by name having count(*) > 1)--------------------------------------------------S.Ahamed |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-06-14 : 04:34:47
|
[code]select t.sno, t.namefrom table tinner join( select name from table group by name having count(*) > 1) don t.name = d.name[/code] KH |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-06-14 : 04:35:27
|
25 secs KH |
 |
|
shah
Starting Member
5 Posts |
Posted - 2007-06-14 : 05:35:45
|
thanx a lot its workingquote: Originally posted by pbguy Select * from <table> where name in(Select name from <table>group by name having count(*) > 1)--------------------------------------------------S.Ahamed
shah |
 |
|
shah
Starting Member
5 Posts |
Posted - 2007-06-14 : 06:45:03
|
Thanx a lot this query is workingquote: Originally posted by khtan
select t.sno, t.namefrom table tinner join( select name from table group by name having count(*) > 1) don t.name = d.name KH
shah |
 |
|
|
|
|