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

I have a table EMP in which the values will be like this

EmpId Ename Sal DeptId
11 Ram 10000 10
11 Ram 10000 10
22 Raj 20000 20
22 Raj 20000 20
33 Anil 15000 30
33 Anil 15000 30

I want to delete only duplicate Rows. After Delete I want
the output like this

EmpId Ename Sal DeptId
11 Ram 10000 10
22 Raj 20000 20
33 Anil 15000 30



Answer Posted / shankar

Delete FROM EMP where EMPID in (Select max(EMPID) from EMP
Group by EMPID having Count(EMPID)>1)

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define Unique Key?

945


Difference between report and query parameter.

1026


What is onf in normalization form?

1002


Explain the use of containers in ssis?

892


What Are the Main Features of SQL Azure?

115


What is the difference between drop table and truncate table?

876


what exactly sql injuction.how to overcome.....

2485


What is self contained sub query?

973


How do I partition a table in sql server?

988


What is the significance of null value and why should we avoid permitting null values?

918


What is difference between drop truncate and delete?

1020


You accidentally delete the msdb database what effect does this have on your existing sql databases, and how do you recover?

938


What is the difference between lock, block and deadlock? : sql server database administration

992


How to store and query spatial data?

937


What are different types of views?

894