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 / b.v.rajaram

delete top (select count(*)-(select count(distinct empname )
from Employee) from Employee)from Employee
where a in (select distinct a from Employee)

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to write a query with a full outer join in ms sql server?

1077


What happens if you add a new index to large table?

942


Explain what is the purpose of sql profiler in sql server?

1074


How to delete all rows with truncate table statement in ms sql server?

1001


What is clr ddl trigger?

966


What is policy based management (pbm)? : sql server database administration

987


What are the differences between substr and charindex in sql server.

1115


What is the difference between DataRow.Delete() and DataRow.Remove()?

1230


What is plan freezing?

968


How to connect a database with sql express.?

1062


How do you handle datasets larger than 50 gb?

162


What is a collation in ms sql server?

1085


What is a synonym for manipulation?

1001


How to optimize stored procedures in sql server?

1185


Do you know what is xpath?

1088