I know this won\'t work, tried it in various forms and failed all times. What is the simplest way to achieve the following result?
ALTER TABLE XYZ AUTO_INCRE
If you really want to do this in MySQL alone, you can just dump the dynamically built alter command to a file on disk and then execute it.
Like so:
select concat('ALTER TABLE XYZ AUTO_INCREMENT = ',max(ID)+1,';') as alter_stmt
into outfile '/tmp/alter_xyz_auto_increment.sql'
from ABC;
\. /tmp/alter_xyz_auto_increment.sql