Delete duplicate records from the table?(Table must have
unique id)
Answer Posted / krishna
select *
from mytable b
join
(
select Duplicatecolumn,MAX(id) id
from mytable
group by Duplicatecolumn
) b1 on b.Duplicatecolumn = b1.Duplicatecolumn
where b.id <> b1.id
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Explain the difference between delete,drop and truncate in SQL Server?
How will you go about resolving deadlocks?
What is the use of tempdb? What values does it hold?
What are pessimistic lock and optimistic lock?
What is log shipping? Can we do logshipping with SQL Server 7.0 - Logshipping is a new feature of SQL Server 2000. We should have two SQL Server - Enterprise Editions. From Enterprise Manager we can configure the logshipping. In logshipping the transactional log file from one server is automatically updated into the backup database on the other server. If one server fails, the other server will have the same db and we can use this as the DR (disaster recovery) plan.
what are triggers? : Sql server database administration
What is the maximum size of sql server database?
What are the drawbacks of reporting in ssrs?
Can group functions be used in the order by clause in ms sql server?
Mention the different types of replication in sql server.
What does it mean if @@cursor_row returns a negative number?
What is difference between delete & truncate commands?
what is the system function to get current user's user id? : Sql server database administration
Explain about Joins?
How to create view in stored procedure sql server?