这是我的问题:下面有两个示例表,我尝试将数据从表二插入表一,新 ID 从四开始。
我尝试更新表二以更改自动增量,然后插入到表一但它没有用。
表一
ID DESC
1. 1 one
2. 2 two
3. 3 three
表2
ID DESC
1. 1 four
2. 2 five
代码:
ALTER TABLE Table_2 AUTO_INCREMENT = 4;
insert into table_1(id,desc)value('four','five');
最佳答案
只插入desc
到表1
示例:
Insert into table_1(desc)
select desc from table_2
关于mysql - 将表 2 中的数据插入表 1,新 ID 以表 1 的最大值开头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47029039/