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...

Delete duplicate rows from a table without primary key by
using a single query
Table Employee
empname salary
A 200
B 300
A 200
C 400
D 500
D 500

Output should be

A 200
B 300
C 400
D 500

Answer Posted / honey

with myCTE as(
select row_number() over( partition by empname order by
empname) as myCount from Employee
)delete from myCTE where myCount >1

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between sql and sql server?

993


What are xml indexes?

946


what are different types of raid configurations? : Sql server database administration

1055


How to create a dml trigger using create trigger statements?

1029


how many no of arguments can be passed in procedures and functions

5553


Can we use where and having clause together?

1039


What new data source types were added in ssrs 2014?

160


What is the recovery model? List the types of recovery model available in sql server?

900


What is a not null constraint?

1024


Does a specific recovery model need to be used for a replicated database? : sql server replication

958


How to create a dynamic cursor with the dynamic option?

1045


What is snapshot report?

165


Can you tell me some of the common replication dmv's and their use? : sql server replication

922


What are the database objects? : SQL Server Architecture

1043


What command must you use to include the not null constraint after a table has already been created?

1142