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

I have tried this query in my PC.Very simply I was able to
remove all duplicate rows.
Please try below query it will work out.

SELECT DISTINCT*FROM EMP(TableName);

You will get below table
EmpId Ename Sal DeptId
11 Ram 10000 10
22 Raj 20000 20
33 Anil 15000 30


Suppose if you have different ENAME but you want only
selected ENAME without duplicate records.
Where We can use below query.

SELECT DISTINCT*FROM EMP WHERE ENAME IN('RAM','RAJ','ANIL');

Please correct me if I am wrong.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does sql server 2016 have ssms?

963


Why main is user defined function?

1014


tell me what is blocking and how would you troubleshoot it? : Sql server database administration

905


How to create view in stored procedure sql server?

1019


How to get a list of columns in a view using "sys.columns" in ms sql server?

994


What is 'Join' and explain its various types.

1138


List the types of recovery model available in sql server?

928


What do you mean by an execution plan?

1117


tell me what are the steps you will take to improve performance of a poor performing query? : Sql server database administration

1024


List the ways in which dynamic sql can be executed?

1016


do you know how to configure db2 side of the application? : Sql server database administration

1043


what's sql server? : Sql server database administration

1000


Describe in brief sql server monitoring ways.

1054


Can we write trigger for view?

1016


What is meant by indexing files?

1043