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

if 3 duplicate records in a table,i want to delete 2 duplicate
records by keeping 1 duplicate and 1 original as it is,how?

Answer Posted / mohamed zunu

create table sampletbl(id int,name varchar(100))

insert into sampletbl values(1,'aa')
insert into sampletbl values(1,'aa')
insert into sampletbl values(1,'aa')


with cte as(
select ROW_NUMBER() over (partition by id order by id) as r_no,* from sampletbl)
delete from cte where r_no>1
select * from sampletbl

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

List the advantages of using stored procedures?

1030


Explain how to send email from sql database?

1023


What is temporal data type?

902


What is the bookmark lookup and rid lookup?

982


Can two different columns be merged into single column? Show practically?

1043


What is named query? : sql server analysis services, ssas

943


Can you explain important index characteristics?

972


Explain can SSRS reports Cache results?

158


What are the new data types are introduced in sql 2000?

887


What is service broker?

989


How to backup SQL Server Reporting Services ?

148


Suppose you want to implement the following relationships while designing tables. How would you do it?a.) One-to-oneb.) One-to-manyc.) Many-to-many

926


How to find the source of a table in sql server?

974


Write a code to select distinct records without using the DISTINCT keyword.

1096


Are there any preferred steps that need to be taken care of before starting the installation of sql server 2000?

979