Delete duplicate records from the table?(Table must have
unique id)

Answer Posted / brijesh darmwal, sandhya

DELETE FROM [MyDb].[dbo].[sandhya]
WHERE id
IN
(SELECT id
FROM
(SELECT MAX(id) as id,name,addr
FROM [MyDb].[dbo].[sandhya] GROUP BY name,addr having
count(id)>=2)
Tmp)

Is This Answer Correct ?    7 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

please differentiate between delete and truncate?

563


What are the new features are introduced in sql server 2012 reporting services?

109


How to create a simple stored procedure in ms sql server?

529


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

523


Explain query editor regions

630






what data regions are and what are the different data regions?

101


How to remove duplicate rows from table except one?

581


What are different type of Collation Sensitivity?

563


Tell me what is sql profiler?

640


Explain something about security and SQL Azure?

90


Find columns used in stored procedure?

536


What is subreport?

100


What is difference between unique and primary key?

486


What are constraints?

596


What is database black box testing?

620