Jump to content

Have no field for one table, but want auto_increment to apply to INSERT


OldWest

Recommended Posts

I am simply adding records but locations_all does not have an id field, and I just want to auto_increment into the ID field of sys_city from the last highest record ID. Here is what I have so far:

 

INSERT INTO sys_city (ID, Mid, cityName) SELECT id, state_id, city_state FROM locations_all

 

So I would like id from locations_all be set to (int)auto_increment like:

 

INSERT INTO sys_city (ID, Mid, cityName) SELECT (int)auto_increment, state_id, city_state FROM locations_all

 

The highest ID in sys_city is 2538, and I would like all records to continue from that number in the ID...

 

I know something like this must be possible, but I cannot find a solution. Any ideas how to address this?

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.