Results 1 to 3 of 3

Thread: Help with SQL

  1. #1
    Join Date
    Dec 2007
    Posts
    288

    Unanswered: Help with SQL

    Running DB2 on Windows V9.5

    Have two identical tables in different schemas with different row counts and duplicates.

    I need to insert from one table into another and replace duplicates???

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    You should be able to do it with the MERGE statement.

  3. #3
    Join Date
    Jul 2009
    Location
    NY
    Posts
    963

    Wink Without MERGE

    In some DB2 versions MERGE doesn't exist:

    Code:
    Insert     into  table2  t2
    select  * from table1  t1
    where 
    not exists (select 1 from table2 t3 where t3.clm1 = t1.clm1)
    Lenny

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •