Answer Posted / navaneethakrishnan
Hi Kumar,
Yes it will delete only the id=1, you have to change the
id=2 whichever u want...
DELETE TOP(1) FROM [tblduplicate] WHERE [ID] = 2
DELETE TOP(1) FROM [tblduplicate] WHERE [ID] = 3
For ur kind information,.. it will delete the duplicate
records only if there is exactly 2 duplication...... if the
id 1 will entered to three times, this query will delete
only one record... because
as we enterd the query as top(1)it will select the top
most and delete the record..
This is the simple query to execute.... there is other ways
also.. to do....
Now use this query to do for more than 2 duplication
DELETE TOP(SELECT COUNT(*) -1 from dbo.tblduplicate where
id = 1)
from dbo.tblduplicate
where id = 1
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
Why truncate is ddl command?
What is order of B+tree?
What do you need to connect php to sql server?
Explain the difference between functions and stored procedures in sql server?
What does it mean to normalize a database and why would you do it?
Where the sql logs gets stored?
Write a query to include a constraint, to check whether the employee salary is greater than 5000?
What is optimistic concurrency?
What are Row versions of DataRow?
What are pages and extents? : SQL Server Architecture
How to get the definition of a trigger back?
How to configure odbc dsn with different port numbers?
Do you know what are pages and extents? : SQL Server Architecture
What is field with example?
query processing