Jump to content

get AUTO INCREMENT and store into a separate table


SeanHarding

Recommended Posts

INSERT INTO table1(id, chicken, beef, pork), table2(id, lettuce, cucumber) VALUES (NULL, '21', '22','23', NULL, '12', '13');

 

Is there a way to retrieve the AUTO INCREMENT of table1 id and insert it into table2 lettuce all within MySQL code?

 

I can do this in PhP by mysql_insert_id(); but that would mean two MySQL queries.

 

Sorry if my query is written incorrectly, was just a passing thought.

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.