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 isolation level at dead lock?
How can we migrate from SQL server to SQL Azure?
What are the various Operating system files that every SQL server 2005 database has and what is the purpose.
Why are views required in the sql server or in any other database?
explain extended properties
How does the report manager work in SSRS?
Other than truncate statement, which other command can by-pass the trigger on the tables?
How to add more data to the testing table in ms sql server?
what is the information that can be stored inside a bit column? : Sql server database administration
What are drilldown reports?
What do you understand by SQL*Net?
Why would you use sql agent?
What purpose does the model database server?
What do you understand by intent locks?
What are types of scd? : sql server analysis services, ssas