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?
Can you type more than one query in the query editor screen at the same time?
How to how to convert numeric expression data types using the convert() function??
What is the purpose of sql profiler in sql server?
You want to implement the one-to-one relationship while designing tables. How would you do it?
How to get the definition of a stored procedure back?
What is sub-query in sql server?
When columns are added to existing tables, what do they initially contain?
What are different types of constraints?
What are different backups available in sql server?
How can we use ConnectorJ JDBC Driver with MS SQL?
Do you know what is openxml in sql server?
How many types of objects are there?
How to create a scrollable cursor with the scroll option?
Is there any difference between primary key and unique with the not null condition?