Reputation: 309
How do you insert into table A all the rows from table B that match a condition from table C?
For instance,
INSERT INTO tableA SELECT * FROM tableB WHERE tableB.id=tableC.id;
This does not work, because mysql does not recognize tableC.
Upvotes: 1
Views: 1619
Reputation: 31920
Then add tableC after From keyword and use tableB.* instead of *
INSERT INTO tableA SELECT tableB.* FROM tableB,tableC WHERE tableB.id=tableC.id;
Upvotes: 1