How to retrieve duplicate rows in a table?
How to delete the duplicate entries in a table?

Answer Posted / madhur/amrutha

Consider a table emp with employee details. The Correct
code to retrieve duplicate rows :


select distinct * from emp where names in
(select names from emp group by names having count(sal)>1)

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of grouping data in a report?

544


What is a fill factor?

627


How to connect to a sql server using odbc_connect()?

621


Explain can SSRS reports Cache results?

112


What is the impact on other user sessions when creating indexes?

542






What are sub reports?

151


Why use stored procedures in sql server?

554


Why olap is used?

567


What is transaction server auto commit?

579


Do you know query execution plan?

588


How to transfer an existing table from one schema to another schema in ms sql server?

511


How to create a simple user defined function in ms sql server?

545


Can group functions be mixed with non-group selection fields in ms sql server?

545


How to create stored procedures with parameters in ms sql server?

526


How do you know if sql server is running on your local system?

542