Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

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.
 
Share this answer
 
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'.
hello,
Is their no primary key constraint in your table ? if their is then the user cannot insert duplicate entries..........

Thanks & Regards
Radix :)
 
Share this answer
 
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900