DE-DUP ROWS

  • I have two Tables linked by table1s ID. I have selected the rows in this table that I need to change. The selection has a consecutively numbered column. this column has duplicates. They are separated by even and odd numbers.

    THe second table is linked by table1s ID. I need to update table 2 so that I can remove the duplicates in table1, consequently the cooresponding rows in table 2. I need to combine the columns in table 2 based on the ID From table 1. Can someone help?

  • Could you give us a few rows of data?  I am having trouble understanding the "seperated by even and odd numbers". 

    I wasn't born stupid - I had to study.

  • Yep, me too. Read it about 5 times & still getting nowhere!

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • I found this resourse to work perfectly for removeing duplicate rows.

    http://www.15seconds.com/issue/011009.htm

    Good Luck

  • ID          ProspectID    Notes          ProspectID  ID         

    482068      126140      not in til       126140      482067

    482094      126163      vm left msg   126163      482093

    482282      126305      n/a              126305      482281

    482298      126320      n/a              126320      482297

    482302      126323      vm no msg 

    Here are some of the rows. the IDs are consectutive. I have separated them into even and odd IDs. I need to combine the Notes from the even and Update them into the odd. The notes are from Table2. the ProspectID and the ID are from Table1. The odd IDs need to have the even IDs notes added them I can remove the even IDs. Notice the prospectIDs are the same. THanks

  • Your message has some ambiguities. But maybe this will get you started. I'm assuming Table2 is on the left (even) and Table1 is on the right (odd).

    update Table1

    set Notes = Table2.Notes

    from Table2

    where (Table2.ProspectID = Table1.ProspectID)

    and (Table2.ID = (Table1.ID + 1))

  • Sorry, I'm assuming alot. I'm new at this thread thing.

    Table 1 contains all ProspectIDs in the table, i have separated them into even and odd based on the ID, which is also in Table1. Table2 contains the notes and an identity column that links to Table1's ID.

  • Still don't understand.

    Post create table statements, insert statements to fill the tables with sample data, and what you want the table data to look like.

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply