Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我填满了一个数据库,我想重置数字自动增量 ID,但我想保持它的顺序与通过检索表中的项目按特定的 varchar(文本)值列对它们进行排序得到的顺序相同。
我知道有很多这样的问题,但我还没有找到任何这样的问题。
提前致谢。
您应该能够从 select 语句中插入如下内容:
INSERT INTO new_table (col_a, col_b) SELECT col_a, col_b FROM old_table ORDER BY col_b