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

When you should use a low fill factor?

1033


How to define the name and server for a new dsn?

1193


How to use transact-sql statements to access the database engine?

1120


What command do we use to rename a db, a table and a column?

975


What are the differences between union, intersect, and minus operators?

1137


You have to store user responses of ‘yes’ and ‘no’ what kind of data type is best suited for this task?

990


when would you go for denormalization? : Sql server database administration

909


What is auditing in sql server?

964


What is the new security features added in sql server 2016? : sql server security

1154


How to create an index on an existing table in ms sql server?

1024


What according to you is the difference between mysql and sql server performance?

1139


What is report snapshot in ssrs?

280


What is trigger explain with program?

1015


Which tools are available to manage SQL Azure databases and servers?

115


Why use identity in sql server?

1166