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

How to insert data with null values?

982


How do indexes help, types?

930


How do use Having,Group by,Group function in SQL?

1699


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

113


What specific conditions database should meet, before you can bulk copy data into it using bcp?

953


What are acid properties of transaction?

908


What is measure group, measure? : sql server analysis services, ssas

977


Write SQL queries on Self Join and Inner Join.

1086


How to reaname table name without using sp_Rename in sql server..?

953


What are the different sql server versions?

943


How to define output parameters in stored procedures?

975


What does null mean?

942


How do you test your database? : sql server database administration

963


Explain filtered indexes?

949


What is the difference between Triggers and Stored Procedure?

1046