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 can you fetch alternate records from a table?

954


What method is used by the Command classes to execute SQL statements that return single values?

1057


What are the tools available in market as an alternative to sql server reporting services?

131


can any body tell me how to know the password of current user in sql server

2070


How to compare the top two records using sql?

1338


What are the disadvantages of primary key and foreign key in SQL?

1101


How to find the source of a table in sql server?

993


Are resultset updatable?

945


Explain what is use of dbcc commands?

1049


What is a raid and what are different types of raid configurations?

1261


How much does sql server 2016 cost?

1051


What are the differences between triggers and stored procedures?

1059


What happens if time-only values are provided as date and time literals?

1004


what are questions asked in TCS for database tester (sqlserver)for 2-3 exp?

5916


Can we insert data into a view?

1127