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
What is the datatype of rowid?
What method is used by the Command classes to execute SQL statements that return single values?
Why I am getting this error when dropping a database in ms sql server?
How many levels of sp nesting are possible?
What according to you is the difference between mysql and sql server performance?
how to restart sql server in single user mode? How to start sql server in minimal configuration mode? : Sql server database administration
How to delete a database in ms sql server?
How to replace the Query Result 'Null Value' with a text ?
How many columns can we include on clustered index ?
how you can get the list of largest tables in a database? : Sql server administration
Tell me what is sql profiler?
What is cdc in sql server?
What is temporal data type?
Can we use where clause with group by?
Write the queries for commands like Create Table, Delete table, Drop Table etc.