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

What is executereader?

952


What is master database? : SQL Server Architecture

1021


What is mssql?

985


How to list all tables in the database using odbc_tables()?

1052


what are the Prerequisites for Replication?

11353


Explain the difference between HTTP and HTTPS in database?

1037


Equi join and non equi join is possible with sql server?

1022


Do you know what are the reporting services components?

976


What is a not null constraint?

1034


What are the differences between left join and inner join in sql server?

1107


What is snapshot report?

165


What do you mean by a dependent functionality in a build?

1154


What are the advantages of using stored procedures in sql server?

1011


What is resource governor in sql server?

997


A trigger can reference objects outside the current database? State true or false.

1010