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
List the advantages of using stored procedures?
Explain how to send email from sql database?
What is temporal data type?
What is the bookmark lookup and rid lookup?
Can two different columns be merged into single column? Show practically?
What is named query? : sql server analysis services, ssas
Can you explain important index characteristics?
Explain can SSRS reports Cache results?
What are the new data types are introduced in sql 2000?
What is service broker?
How to backup SQL Server Reporting Services ?
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
How to find the source of a table in sql server?
Write a code to select distinct records without using the DISTINCT keyword.
Are there any preferred steps that need to be taken care of before starting the installation of sql server 2000?