Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How would you add a section to a table?

1051


Why are you getting errors when creating a new odbc dsn?

1225


What is difference between table aliases and column aliases? Do they affect performance?

970


What is resource db in sql server?

1030


How to enter comments in transact-sql statements?

948


How to call stored procedure using http soap?

1081


What is a result set object returned by odbc_exec()?

1032


What is outer join in sql server joins?

1124


What is bookmark link in ssrs?

244


What is the difference between grant and with grant while giving permissions to the user?

967


What are the different types of Indexes available in SQL Server?

1009


Why and when do stored procedure recompile?

984


Suppose you want to implement the one-to-many relationships while designing tables. How would you do it?

972


What is correlated subquery in sql server?

1076


How to copy the tables, schema and views from one sql server to another?

1050