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

Explain Capacity planning to create a database? and how to monitor it?

4249


What does the on delete cascade option do?

1068


Explain what is log shipping?

1199


How to find table changes in sql server?

1178


What is self join in sql server joins?

1119


Why is replication required on the sql server?

1107


What is data compression? : sql server database administration

1019


Mention the different types of triggers?

1211


How do you troubleshoot errors in a SQL Server Agent Job?

1113


What are the main differences between #temp tables and @table variables and which one is preferred?

1140


Define magic tables in sql server?

1124


Explain Geography datatype in SQL Server

1194


What is an indexed view?

1012


how to define testing of network layers? : Sql server database administration

1026


where the connection string store in the database

2124