INSERT IGNORE INTO table3
(id1, id2) VALUES
SELECT id1, id2 FROM table1, table2;
What's wrong with the above SQL query?
It shows me syntax error.
INSERT IGNORE INTO table3
(id1, id2) VALUES
SELECT id1, id2 FROM table1, table2;
What's wrong with the above SQL query?
It shows me syntax error.
Remove the word VALUES
. See here for spec:
INSERT IGNORE INTO table3
(id1, id2)
SELECT id1, id2 FROM table1, table2;
And note Russ' response.
Remove "VALUES".
Oh, and by the way, you've got a cartesian join. You should add syntax to join table1 to table2.
try this
INSERT IGNORE INTO table3(id1, id2)
SELECT id1, id2 FROM table1, table2;
VALUES
is not used in combination with a SELECT
statement