in tabase table having a column in it empname field is
there which having 5 duplicate values is there i want
deleted all the duplicates i want showing only one name
only.
Answer Posted / jiri
WITH DUPLICATE(EmpName, RowNumber)
AS
(SELECT EmpName,ROW_NUMBER() OVER (PARTITION BY EmpName
order by EmpName) AS RowNumber
FROM Employee)
DELETE FROM DUPLICATE WHERE RowNumber > 1
------------------------------------------------------------
Using CTE (Common Table Expressions) and ROW_NUMBER as
ranking fucntion
Jiri JANECEK
MSE, MBA, MCSD.NET
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
When you should use a low fill factor?
How to define the name and server for a new dsn?
How to use transact-sql statements to access the database engine?
What command do we use to rename a db, a table and a column?
What are the differences between union, intersect, and minus operators?
You have to store user responses of ‘yes’ and ‘no’ what kind of data type is best suited for this task?
when would you go for denormalization? : Sql server database administration
What is auditing in sql server?
What is the new security features added in sql server 2016? : sql server security
How to create an index on an existing table in ms sql server?
What according to you is the difference between mysql and sql server performance?
What is report snapshot in ssrs?
What is trigger explain with program?
Which tools are available to manage SQL Azure databases and servers?
Why use identity in sql server?