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

List types of tables in SQL Azure?

126


What is user defined stored procedures?

880


How to achieve Paging of records in SQL SERVER?

1036


What are the restrictions while creating batches in sql server?

1004


What are the types of sql server?

992


Can a database be shrunk with users active?

1065


Can we use where clause in union?

1005


What is a fan-out query in SQL Azure?

121


What is the security principal at the server level that represents your session?

965


What is the stuff?

950


Can we take the full database backup in log shipping?

901


How to fine-tune reports?

247


How to create a ddl trigger using "create trigger" statements?

1071


Where is my database stored on the hard disk in ms sql server?

999


How dts is used to extract, transform and consolidate data?

1025