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 many types of stored procedures are there in sql server?

0 Answers  


What is difference between table aliases and column aliases? Do they affect performance?

0 Answers  


How do I start sql server agent automatically?

0 Answers  


Tell me what is sql profiler?

0 Answers  


What are the database objects? : SQL Server Architecture

0 Answers  


Explain about system stored procedure?

0 Answers  


What is cursors?

0 Answers   NA,


If a stored procedure is taking a table data type, how it looks?

1 Answers  


How to turn off warning messages during php execution?

0 Answers  


What is resource governor?

0 Answers  


What is a trigger and its types?

0 Answers  


What is ms sql server reporting services?

0 Answers  


Categories