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
Which joins are sql server default?
What are the differences between user defined functions and stored procedures?
What is 2nf normalization?
What is stretch database in sql server?
List some of the rules that apply to creating and using a ‘view’
What is multi-statement table-value user-defined function?
Explain what are the restrictions while creating batches in sql server?
How to use clusters?
You want your report to display a hyperlink that will take users to your intranet. How do you configure such a hyperlink?
what is a self join? : Sql server database administration
Where can you find the error log information? : sql server database administration
Why we should not use triggers?
How to display a past time in days, hours and minutes?
Tell me about the approaches which you used to counter the DI problems.
Explain the properties of sub-query in sql server?