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

you accidentally delete the msdb database what effect does this have on your existing sql databases, and how do you recover? : Sql server administration

705


Where can you add custom error messages to sql server?

575


How to move database physical files in ms sql server?

524


What according to you is the difference between mysql and sql server performance?

551


What is the difference between left and right outer join?

536






Mention the different types of triggers?

541


How to create a view on an existing table in ms sql server?

575


What are the types of stored procedures in an sql server?

468


How can we call UDF(User Define Function) using C# code in ASP.net ?

5921


What is analysis service repository?

580


what is the system function to get current user's user id? : Sql server database administration

543


How many types of attribute relationships are there? : sql server analysis services, ssas

575


How much is a sql server license?

498


what kind of lan types do you know? : Sql server database administration

512


What is instead of dml trigger?

579