How can we retrive duplicate rows from a table in sql server.

Posted by Udaysimha under Sql Server on 1/17/2012 | Points: 10 | Views : 989 | Status : [Member] | Replies : 3
Hi All,
Please let me know the query to retrive the duplicate rows only form a table in sql server.
Thanks

uday


Responses

Posted by: Raj_chennai on: 1/17/2012 [Member] Starter | Points: 25

Up
0
Down
Select columnName From Table_name
Group By columnName
Having count (*) > 1

raj

Udaysimha, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Udaysimha on: 1/17/2012 [Member] Starter | Points: 25

Up
0
Down
Thanks for your reply boss

uday

Udaysimha, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sriramnandha on: 6/22/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Raj u r Query is Wrong u cant retrive Duplicate Record..

To Retrive Duplicate Records

select * from employee where empid not in ( select empid from employee group by empid having count(*)<1)


Regards
Sriram.R

sriram

Udaysimha, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response