Hi,
I have two mysql tables, one needs to start its auto-increment column id with the last value of the last inserted row in the other table (plus 1).
According to mysql manual you can restart the value of an auto increment column like this:
mysql> ALTER TABLE tbl AUTO_INCREMENT = 100;
However, this is not possible:
mysql> ALTER TABLE tb2 AUTO_INCREMENT = (SELECT MAX(id) FROM tbl1);
I need to perform something like this because I'm filling the tables using a script. Is there another way to achieve it?