0

我创建了一个包含两个外键的表。我想用两个相关表中的默认值填充表。它们看起来像这样:

+---------------+
| Table A       |
+---------------+
| id            |
| other info... |
+---------------+

+---------------+
| Table B       |
+---------------+
| id            |
| level         |
| other info... |
+---------------+

我希望填充新表,以便每个 A 与每个 B 都有关系。如何使用 MySQL UPDATE 语句来做到这一点?

4

1 回答 1

0
insert into AB select a.id, b.id from A join B;
于 2013-04-15T15:47:59.243 回答