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

How to retrieve duplicate rows in a table?
How to delete the duplicate entries in a table?

Answer Posted / madhur/amrutha

select ROW_NUMBER() OVER (ORDER BY names ASC) AS ROWID, *
into #temp from emp
select * from #temp where ROWID not in(
select b.ROWID from
(
select ROW_NUMBER() OVER (ORDER BY names ASC) AS ROWID, *
from emp
except
SELECT ROW_NUMBER() OVER (ORDER BY names ASC) AS ROWID, *
FROM
(
select names , sal from emp
union
select distinct names,sal from emp) as a ) as b)

drop table #temp

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to divide query output into multiple groups with the group by clause in ms sql server?

1092


How to drop an existing schema in ms sql server?

1146


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

1101


Does windows server 2016 come with sql server?

986


What is an indexing strategy?

1072


What is difference between rownum and rowid?

958


role of sql sever 2005 in database rather than any other database

1992


Detail about the hardware which is supported by SQL server?

1122


How to concatenate two character strings together?

1170


Is it possible to update the views? If yes, how, if not, why?

1089


Detail about query optimizer?

1160


What is the purpose of forms?

1004


What is scalar user-defined function?

1189


Does partitioning ssd reduce performance?

930


What is policy management?

1048