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 isolation level at dead lock?

2151


How can we migrate from SQL server to SQL Azure?

113


What are the various Operating system files that every SQL server 2005 database has and what is the purpose.

1062


Why are views required in the sql server or in any other database?

965


explain extended properties

991


How does the report manager work in SSRS?

150


Other than truncate statement, which other command can by-pass the trigger on the tables?

1134


How to add more data to the testing table in ms sql server?

1090


what is the information that can be stored inside a bit column? : Sql server database administration

965


What are drilldown reports?

154


What do you understand by SQL*Net?

1033


Why would you use sql agent?

1264


What purpose does the model database server?

1101


What do you understand by intent locks?

1012


What are types of scd? : sql server analysis services, ssas

1016