SET @size = CONVERT((SELECT TABLE_ROWS FROM information_schema.tables WHERE table_name='Persons' and table_schema = 'Movies2'), unsigned);
ALTER TABLE Movies2.Actors AUTO_INCREMENT=@size;
答案 0 :(得分:1)
以下内容应该有效:
ALTER TABLE Movies2.Actors AUTO_INCREMENT = (SELECT COUNT(*) FROM Movies2.Persons);