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

Which joins are sql server default?

939


What are the differences between user defined functions and stored procedures?

1007


What is 2nf normalization?

970


What is stretch database in sql server?

1028


List some of the rules that apply to creating and using a ‘view’

817


What is multi-statement table-value user-defined function?

938


Explain what are the restrictions while creating batches in sql server?

1023


How to use clusters?

883


You want your report to display a hyperlink that will take users to your intranet. How do you configure such a hyperlink?

304


what is a self join? : Sql server database administration

963


Where can you find the error log information? : sql server database administration

972


Why we should not use triggers?

921


How to display a past time in days, hours and minutes?

965


Tell me about the approaches which you used to counter the DI problems.

1268


Explain the properties of sub-query in sql server?

956