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 can a database be repaired?

0 Answers  


SQL Server Performance Tuning for Stored Procedures & reducing debugging time?

1 Answers   CarrizalSoft Technologies,


Does transparent data encryption provide encryption when transmitting data across the network?

0 Answers  


What is RMS migrations?

0 Answers   Satyam,


Explain timestamp datatype?

0 Answers  


What are the steps to process a single select statement?

0 Answers  


How to retrieve error messages using mssql_get_last_message()?

0 Answers  


How to insert stored procedure result into temporary table?

0 Answers  


What is dknf in normalization form?

0 Answers  


what are questions asked in TCS for database tester (sqlserver)for 2-3 exp?

0 Answers   ABC, TCS,


Which command using Query Analyzer will give you the version of SQL server and operating system?

3 Answers  


Difference between Triggers and Stored Procedure

23 Answers   Claimat, HCL, Protech, Silgate,


Categories