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
How can you fetch alternate records from a table?
What method is used by the Command classes to execute SQL statements that return single values?
What are the tools available in market as an alternative to sql server reporting services?
can any body tell me how to know the password of current user in sql server
How to compare the top two records using sql?
What are the disadvantages of primary key and foreign key in SQL?
How to find the source of a table in sql server?
Are resultset updatable?
Explain what is use of dbcc commands?
What is a raid and what are different types of raid configurations?
How much does sql server 2016 cost?
What are the differences between triggers and stored procedures?
What happens if time-only values are provided as date and time literals?
what are questions asked in TCS for database tester (sqlserver)for 2-3 exp?
Can we insert data into a view?