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 |
|
Vaishu
Posting Yak Master
178 Posts |
Posted - 2008-07-07 : 06:24:54
|
| HiI have col1 in a table like belowCol1-----Col2------Col3123-------kj--------tuu254-------etr--------keu233-------fda--------you233-------da--------hgju233-------rte--------kjuI am trying to get like belowselect col1,col2,col3 From tbl where count(col1) > 1Advanc Thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-07 : 06:28:53
|
| select col1,col2,col3 From tbl where col1 in(select col1 from tbl group by col1 having count(col1) > 1 |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-07-07 : 06:30:44
|
| [code]declare @t table( col1 int, col2 varchar(10), col3 varchar(10))insert @tselect 123, 'kj', 'tuu' union allselect 254, 'etr', 'keu' union allselect 233, 'fda','you' union allselect 233, 'da','hgju' union allselect 233, 'rte','kju'select *from @t t1join(select col1 from @t group by col1 having count(*) > 1) t2on t1.col1 = t2.col1[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
Vaishu
Posting Yak Master
178 Posts |
Posted - 2008-07-07 : 07:06:15
|
| HiThanks a lot guys |
 |
|
|
|
|
|
|
|