SQL INSERT INTO from multiple tables

The Solution to SQL INSERT INTO from multiple tables is


You only need one INSERT:

INSERT INTO table4 ( name, age, sex, city, id, number, nationality)
SELECT name, age, sex, city, p.id, number, n.nationality
FROM table1 p
INNER JOIN table2 c ON c.Id = p.Id
INNER JOIN table3 n ON p.Id = n.Id

~ Answered on 2013-12-05 16:02:42


Most Viewed Questions: