13,141,576 members (56,128 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 215 Graeme_Grant 210 Jochen Arndt 185 ppolymorphe 113 Karthik Bangalore 110
 OriginalGriff 5,092 Graeme_Grant 5,018 ppolymorphe 1,814 Jochen Arndt 1,707 CPallini 1,500