delete duplicate rows
-
Example Table : Cl1 Cl2 ID SecndClmnNAme Delete From Tab Where ID NOt In Select Distinct ID From Tab)
-
delete from tablename where id not in (select distinct id from tablename )
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
Are you sure this works? Surely, if there are duplicate rows there are duplicate ids? I mean, if you have this id name 1 bob 2 fred 1 bob your query will not delete anything as all ids occur in the distinct. Or have I missed something?
Bob Ashfield Consultants Ltd
-
Example Table : Cl1 Cl2 ID SecndClmnNAme Delete From Tab Where ID NOt In Select Distinct ID From Tab)
Are you sure this works? Surely, if there are duplicate rows there are duplicate ids? I mean, if you have this id name 1 bob 2 fred 1 bob your query will not delete anything as all ids occur in the distinct. Or have I missed something?
Bob Ashfield Consultants Ltd
-
you are not suppose to have that problem you know?! my advice for you is to start all from the beginning!!! Question yourself why you need that? can´t you achieve what you want to do without creating duplicate rows? can you see that you are creating unnecessary procedures! trying to help you there:rose:
nelsonpaixao@yahoo.com.br trying to help & get help