1. We have moved to a new forum! There may be a few things not working properly so please let us know if you find a bug. Remember to use the bbCode [ sql ] tag for SQL statements.

Insert data from tableA into TableB if idA is not already in tableB?

Discussion in 'SQL - Questions and Answers' started by alexfr, May 24, 2006.

  1. alexfr New Member

    Dialect: SQL 92
    Insert data from tableA into TableB if idA is not already in tableB?
  2. alexfr New Member

    Dialect: SQL 92
    SQL:
    INSERT INTO tableB (idB, nomB) 
    SELECT idA, nomA FROM tableA
    WHERE NOT EXISTS (
    SELECT idB FROM tableB
    WHERE tableB.idB = tableA.idA
    )

Share This Page