Delete duplicate rows from a table without primary key by
using a single query
Table Employee
empname salary
A 200
B 300
A 200
C 400
D 500
D 500

Output should be

A 200
B 300
C 400
D 500

Answer Posted / b.v.rajaram

delete top (select count(*)-(select count(distinct empname )
from Employee) from Employee)from Employee
where a in (select distinct a from Employee)

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is built-in/administrator?

580


How to connect ms access to sql servers through odbc?

557


What is the difference between sdf and mdf?

681


What is the New in SQL server 2008?

585


What are the purpose of Normalisation?

642






What is primary key index?

543


Suppose you want to implement the following relationships while designing tables. How would you do it?a.) One-to-oneb.) One-to-manyc.) Many-to-many

529


 Explain what is sql override for a source taLle in a mapping?

581


What to check if a User database is locked?

592


Can two tables share a primary key?

526


what are the different stages of Report Processing?

97


What are cursors? Explain different types of cursors. What are the disadvantages of cursors? How can you avoid cursors?

694


If you are given access to a SQL Server, how do you find if the SQL Instance is a named instance or a default instance?

675


What are horizontal and vertical scaling?

146


How can we delete Duplicate row in table?

642