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

Why use triggers?

964


What is the difference between system objects and user objects?

1095


How do I find the query plan in sql server?

905


What is the difference between rank and dense_rank?

990


Explain for xml explicit mode?

908


What do you mean by tablesample?

1028


Can sub report data source be different from that of the parent report?

134


What is meant by indexing?

934


What program is used to store the data source file?

902


Can you please explain the difference between primary keys and foreign keys?

1053


What is server-level principal?

120


What are the steps you will take to improve the performance of a poor performing query?

923


Give the query of getting last two records from the table in SQL SERVER?

899


How many databases instances are there in sql server 2000?

1020


How to find the list of fixed hard drive and free space on server?

1090