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
What are key, name and value columns of an attribute? : sql server analysis services, ssas
How should i optimize the time for execution of stored procedure having single input and many output from the different tables?
What is single-user mode?
What is the purpose of forms?
What are the types of database schema? : sql server analysis services, ssas
Define Unique Key?
Can you explain about buffer cash and log cache in sql server?
Why use triggers?
What is hot add cpu in sql server 2008?
How sql server executes a statement with nested subqueries?
What is an execution plan? How would you view the execution plan?
How to attach adventureworkslt physical files to the server?
What is Service Broker in sql server 2012?
Do comments need to go in a special place in sql server 2005?
What is dml command?