StoneDeCroze
Programmer
Hi All,
I have two tables and I want to insert data from them into a third table.
Question:
Am I better to write two inserts statements e.g.
INSERT INTO table3 (field1, field2) SELECT field1, field2 FROM table1
and
INSERT INTO table3 (field1, field2) SELECT field1, field2 FROM table2
OR one insert statement
INSERT INTO table3 (field1, field2)
SELECT field1, field2 FROM table1
UNION ALL
SELECT field1, field2 FROM table2
Are two inserts better or worse than one insert and a UNION ALL.
Cheers
Peter
I have two tables and I want to insert data from them into a third table.
Question:
Am I better to write two inserts statements e.g.
INSERT INTO table3 (field1, field2) SELECT field1, field2 FROM table1
and
INSERT INTO table3 (field1, field2) SELECT field1, field2 FROM table2
OR one insert statement
INSERT INTO table3 (field1, field2)
SELECT field1, field2 FROM table1
UNION ALL
SELECT field1, field2 FROM table2
Are two inserts better or worse than one insert and a UNION ALL.
Cheers
Peter