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

What are key, name and value columns of an attribute? : sql server analysis services, ssas

1066


How should i optimize the time for execution of stored procedure having single input and many output from the different tables?

1960


What is single-user mode?

984


What is the purpose of forms?

1003


What are the types of database schema? : sql server analysis services, ssas

1193


Define Unique Key?

1069


Can you explain about buffer cash and log cache in sql server?

998


Why use triggers?

1068


What is hot add cpu in sql server 2008?

986


How sql server executes a statement with nested subqueries?

1093


What is an execution plan? How would you view the execution plan?

1131


How to attach adventureworkslt physical files to the server?

1160


What is Service Broker in sql server 2012?

1075


Do comments need to go in a special place in sql server 2005?

916


What is dml command?

1020