Check for Duplicate Data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Charney

    #1

    Check for Duplicate Data

    I have a temp table that has data I am inserting into a SQL DB table.

    There is a column in both tables called PAT_ID. I need to check the SQL
    table against the temp table for duplicate data in both columns of both
    tables.

    In other words if one row in the temp table PAT_ID has a value of 472440 and
    the SQL DB table also has a row with PAT_ID = 472440 then I want to delete
    the temp table row.

    Does that make sense??

    Thanks for any insight!!

    Mike
    m charney at dunlap hospital dot org

    Is life the same when it goes backwards?




  • Rich P

    #2
    Re: Check for Duplicate Data

    Hi Mike,

    Try

    Docmd.RunSql "Delete From temp where Pat_ID IN (Select Pat_ID from
    SqlTbl)"



    Rich

    *** Sent via Developersdex http://www.developersdex.com ***

    Comment

    • Mike Charney

      #3
      Re: Check for Duplicate Data

      Thanks Rich!!

      That worked like a charm!!

      Mike

      "Rich P" <rpng123@aol.co m> wrote in message
      news:lQ49g.21$6 t6.6003@news.us west.net...[color=blue]
      > Hi Mike,
      >
      > Try
      >
      > Docmd.RunSql "Delete From temp where Pat_ID IN (Select Pat_ID from
      > SqlTbl)"
      >
      >
      >
      > Rich
      >
      > *** Sent via Developersdex http://www.developersdex.com ***[/color]


      Comment

      Working...