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 / honey
with myCTE as(
select row_number() over( partition by empname order by
empname) as myCount from Employee
)delete from myCTE where myCount >1
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
what is the difference between them (ethernet networks and token ring networks)? : Sql server database administration
What are subquery and its properties?
Name 3 of the features that the sql server built-in function loginproperty performs on standard logins? : sql server security
Do you know the isolation level that sql server support?
What are the filtered indexes?
Define synonym?
Explain the concepts and capabilities of sql server?
How to delete a database in ms sql server?
How do you improve the performance of a SQL Azure Database?
What do you understand by triggers and mention the different types of it?
How many types of database relationship in sql server?
What is user defined stored procedures?
What is thr feature of change data capture?
What are the different Authentication modes in SQL Server and how can you change authentication mode?
What are differences in between sql server 2012 and sql server 2016?