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
What are the tool windows in sql server management studio? : sql server management studio
What is lock escalation? : sql server database administration
What do you understand by a view? What does the with check option clause for a view do?
Name some of the open source software that you can use in alternative to SSR?
What is transaction server consistency?
Explain syntax for disabling triggers?
What do you understand by coalesce in sql server?
What is the difference between commit and rollback?
Can we use trigger new in before insert?
What is sql server agent and what are the two modes of authentication in sql server?
What is public role in sql server?
Do you know what is normalization of database? What are its benefits?
What is compound operators?
What new data source types were added in ssrs 2014?
What is an etl file?