Click here to Skip to main content
14,644,614 members
Rate this:
Please Sign up or sign in to vote.
I was Created a table.In which somebody insert two same rows in ie.exactly equal entries in two rows.So i want to delet one row of them.
how can i do it with the hepl of query??????
tell the condition in where cluse.
Posted
Updated 13-May-10 23:51pm
v2
Rate this:
Please Sign up or sign in to vote.

Solution 1

Use this query :
delete top(1) from (tablename) where (condition)


In where condition, put a condition such that only those 2 same records will be selected.
   
Comments
Ankur\m/ 14-May-10 5:47am
   
I guess he is asking about that condition only.
YOGESH DHAGE 14-May-10 5:50am
   
it gives syntax error like
Incorrect syntax near the keyword 'top'.
Rate this:
Please Sign up or sign in to vote.

Solution 2

hello,
Is their no primary key constraint in your table ? if their is then the user cannot insert duplicate entries..........

Thanks & Regards
Radix :)
   
Comments
Ankur\m/ 15-May-10 3:09am
   
No, that's not correct. Only the primary key field(or if unique is used) wouldn't have duplicate entries. All other fields can have same entries.
For ex, I can have 'Ankur' in Name column as many times as I want if it's not a primary key. Delete your answer as it is not correct.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100