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
How to connect ms access to sql servers through odbc?
How to use union to merge outputs from two queries together in ms sql server?
How to get the definition of a trigger back?
What are unicode character string data types in ms sql server?
Distinguish between nested subquery and correlated subquery?
How to manipulate data from one table to another table ?
Why transaction is important?
Explain sql server service broker?
What is failover clustering overview?
What is difference between createstatement and preparedstatement?
explain what is a deadlock and what is a live lock? How will you go about resolving deadlocks? : Sql server database administration
Why we use the openxml clause?
How to filter records of table in SQL SERVER?
State a few properties of relational databases?
what is new philosophy for database devises for sql server 7.0? : Sql server database administration