If I understand it correctly, you should only need to compare the rows with one big if command that is applied to each remaining row, something like:
Do a select into v1,v2...vn of all the columns of the row you encounter with your cursor follow it with set v i=rownum where col1=.v1 and col2=.v2,.... and coln=.vn and rownum ne (not equal) cursor_row_num if i is not null then del row from tablename where col1=.v1 and col2=.v2 ... and coln=.vn and rownum ne cursor_row_num. endi [goto next row (that has not been deleted) and loop back to above] bill Chuck Finley wrote: > Hopefully one of you very smart people can help me out. I imported data into > a table that contains customer payment information. Multiple months of > payments are included in this data. Often all rows are duplicates including > a the quantity column. Is there an easy way to compare rows and when all > columns are the same to tally the quantity and delete all rows except one > and then update the quantity to the correct number. I have written a cmd > file that accomplishes this by stepping through the table with a cursor and > uses a boatload of nested if / then statements to check is all the rows are > exactly the same, but this just seems real inefficient to me. I hope I am > missing a way to compare two entire rows. Any ideas would be much > appreciated.

