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
What are various aggregate functions that are available?
What is the difference between a stored procedure and a user defined function?
What are the different types of join?
Explain sql delete command?
Explain intellisense for query editing
Can we delete data from a view?
Your company has 50 branches all over the country all the branches, including the head office have sql server as the database every night all 50 branches upload certain information to the head office which replication topology is best suited for the above scenario?
How do I debug a stored procedure in sql server?
What is difference between index and primary key?
Can we do dml on views?
What happens if ntwdblib.dll is missing on your machine?
How do you delete a data source?
how to avoid cursors? : Sql server database administration
What type of Index will get created after executing the above statement?
What is a benefit of using an after insert trigger over using a before insert trigger?