adspace


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

Can we make the the chages By Using the Sql if u know any function or process please inform me Actuall result: BRK1 Break 1 Part 1 00:01:00:00 60 BRK1 Break 1 Part 2 00:01:00:00 60 BRK2 Break 2 Part 1 00:01:00:00 60 BRK2 Break 2 Part 2 00:01:00:00 60 BRK2 Break 2 Part 3 00:01:00:00 60 BRK3 Break 3 Part 1 00:01:00:00 60 BRK3 Break 3 Part 2 00:01:00:00 60 Desired O/P: BRK1 Break 1 Part 1 00:01:00:00 60 Part 2 00:01:00:00 60 BRK2 Break 2 Part 1 00:01:00:00 60 Part 2 00:01:00:00 60 Part 3 00:01:00:00 60

2296


How do I find query history in sql server?

1025


List the ways in which dynamic sql can be executed?

1087


Why we use the openxml clause?

1080


How can you append an identity column to a temporary table?

1071


Can sql servers link to other servers like oracle?

919


what is the Ticketing tool used in Wipro technologies at Bangalore...???

8232


How to convert character strings into numeric values?

1192


Explain “row_number()” in sql server with an example?

1080


What is the difference between upgrade and migration in sql server?

1185


How can we solve concurrency problems?

1123


What are the different subsets of sql?

1654


When should you use an instead of trigger?

1054


Can you index views?

955


Disadvantages of the indexes?

1225