12,403,978 members (63,904 online)
Rate this:
See more:
i want to show through select statement to find a duplicate value from a column ..
like i am having this table

stid stname
1 rahul
2 amit
3 abhi
4 rahul
5 rahul

now i want show like that.

stid stname
1 rahul
4 rahul
5 rahul

Posted 8-Feb-13 18:51pm

Rate this:

## Solution 2

try this
```DECLARE @t TABLE (stid  INT, stname VARCHAR(10))
INSERT INTO @t(stid, stname) VALUES (1, '1')
INSERT INTO @t(stid, stname) VALUES (2, '1')
INSERT INTO @t(stid, stname) VALUES (3, '2')
INSERT INTO @t(stid, stname) VALUES (4, '3')
INSERT INTO @t(stid, stname) VALUES (5, '4')
INSERT INTO @t(stid, stname) VALUES (6, '5')
INSERT INTO @t(stid, stname) VALUES (7, '6')

select * from @t where stname IN ( SELECT stname FROM @t GROUP BY stname HAVING COUNT(stname) > 1)```
amitkumar5734 9-Feb-13 6:01am

thnq sir.. thanks a lot.
Rate this:

## Solution 1

Top Experts
Last 24hrsThis month
 OriginalGriff 313 Richard MacCutchan 217 Karthik Bangalore 210 Suvendu Shekhar Giri 185 ppolymorphe 145
 OriginalGriff 7,386 ppolymorphe 3,175 Karthik Bangalore 3,127 Richard MacCutchan 2,342 F-ES Sitecore 2,262