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



Answers were Sorted based on User's Feedback



I have a table EMP in which the values will be like this EmpId Ename Sal DeptId 11 Ra..

Answer / 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

I have a table EMP in which the values will be like this EmpId Ename Sal DeptId 11 Ra..

Answer / samadhan

use distinct keywor in sql query

Is This Answer Correct ?    1 Yes 4 No

I have a table EMP in which the values will be like this EmpId Ename Sal DeptId 11 Ra..

Answer / ashim kumar pal

SET rowcount 3

delete distinct * from table

set rowcount 0

select * from table

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More SQL Server Interview Questions

How to execute a sql statement using mssql_query()?

0 Answers  


What are out-of-range errors with date and time literals?

0 Answers  


Tell me what is a linked server?

0 Answers  


How to select some specific rows from a table in ms sql server?

0 Answers  


what is a check constraint?

0 Answers  


How do I open port 1433?

0 Answers  


Do you know what is openxml in sql server?

0 Answers  


What is BCP? When does it used in sql server 2012?

0 Answers   TryTechnicals Pvt Ltd,


How many types of TRIGGERS are there in MS SQL Server?

8 Answers   CarrizalSoft Technologies, TCS, United Healthcare,


What is the difference between value type and reference type?

0 Answers  


wat wil hapn if we give the both read and deny read permission to user?

0 Answers   IBM,


Explain the third normal form(3nf)?

0 Answers  


Categories