Updating single record within a bunch of duplicates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ayo
    New Member
    • Mar 2006
    • 1

    Updating single record within a bunch of duplicates

    Hi I'm a newbie here. I'm hoping someone can help me..

    Here is the scenario:
    I have a bunch of duplicate records I need to clean up
    This query below will help me identify the list of duplicate records.

    select * from Tablename
    where acctdebitid like '57%' and status = 'WILLPROCESSON'
    and datecreate like '2006/01/13%'
    order by customerid, id, listid, date

    All the columns are dups with the exception of one obvious one which is the primary key.

    I would like to be able to iterate through this entire list and identify the first row in a set of duplicate records and do an update. Is this possible in SQL ?

    Thanks in advance!
    Last edited by Ayo; Mar 29 '06, 05:16 PM.
  • CaptainD
    New Member
    • Mar 2006
    • 135

    #2
    What kind of update?

    I've not tried it but off my head I would look into an Update with a "where Not IN (Select top 1 with a count >1 and a group by cluase)" type statement.

    Sorry, I'm not at my work computer with a server to do a test on.

    Hope it points you in a right direction...



    Originally posted by Ayo
    Hi I'm a newbie here. I'm hoping someone can help me..

    Here is the scenario:
    I have a bunch of duplicate records I need to clean up
    This query below will help me identify the list of duplicate records.

    select * from Tablename
    where acctdebitid like '57%' and status = 'WILLPROCESSON'
    and datecreate like '2006/01/13%'
    order by customerid, id, listid, date

    All the columns are dups with the exception of one obvious one which is the primary key.

    I would like to be able to iterate through this entire list and identify the first row in a set of duplicate records and do an update. Is this possible in SQL ?

    Thanks in advance!

    Comment

    Working...