How can I return distinct records and ignore dupes without Primary Key?

  • Have a table without a Primary Key (Identity). It has led to lots of dupes. Yet each record has something that makes it unique.

    Timestamp column looks like the "best" identity coupled with Account_ID, but even the Timestamp is repeated for some columns.

    Can I use ROW_COUNT + Account_ID + Timestamp to select ONE UNIQUE record ONLY and ignore the duplicate records?

    Is there a better way?

  • Can you maybe give the table structure, a few sample rows and your desired output please?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • I second Gail's comment.

    but here is a clue perhaps.....SELECT DISTINCT....;)

    However this contraction is bizarre!

    ...It has led to lots of dupes. Yet each record has something that makes it unique...

    What does that mean?

    Hiding under a desk from SSIS Implemenation Work :crazy:

Viewing 3 posts - 1 through 2 (of 2 total)

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