Interview Question

Interview London, England (UK)

With reference to Table1 and Table2, write one query, which

  will select those records from Table2 that do not exist in Table1, and then insert those records into Table1. Without using sub queries or merge.
Answer

Interview Answer

1 Answer

0

INSERT INTO Table1 AS t1 SELECT DISTINCT Table2.* FROM Table2 AS t2 INNER JOIN Table1 AS t1 ON t1.id <> t2.id

Nick Woebcke on Oct 17, 2012

Add Answers or Comments

To comment on this, Sign In or Sign Up.