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...

Delete duplicate rows from a table without primary key by
using a single query
Table Employee
empname salary
A 200
B 300
A 200
C 400
D 500
D 500

Output should be

A 200
B 300
C 400
D 500

Answer Posted / arijit mandal

DELETE FROM Employee a
WHERE ROW_NUMBER() <>
( SELECT MIN( ROW_NUMBER() )
FROM Employee b
WHERE a.empname = b.empname
AND a.salary = b.salary)

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we insert data into view sql server?

883


whats the maximum size of view state??

2147


why would you call update statistics? : Sql server database administration

1011


How to find related tables in sql server?

871


What is the difference between rank and dense_rank?

990


what is raid and what are different types of raid configurations? : Sql server database administration

975


What is transaction server consistency?

980


What is Transparent Data Encryption?

939


Do you think BCNF is better than 2NF & 3NF? Why?

1226


If you are given access to a SQL Server, how do you find if the SQL Instance is a named instance or a default instance?

1040


Sql server reporting services vs. Crystal reports.

118


Explain what is scheduled job and how to create it?

898


What does COMMIT command do?

1007


How to implement service broker?

921


How to provide values to user defined function parameters?

968