Re: Nested inserts possible?

2010-03-12 Thread Johan De Meersman
Have a look at last_insert_id() . On Fri, Mar 12, 2010 at 3:48 PM, Keith Clark wrote: > I have two tables and I have data to insert into both at the same time, > but the second table depends on an ID that

RE: Nested inserts possible?

2010-03-12 Thread Gavin Towey
); INSERT INTO child2 VALUES (@id, ... ); -Original Message- From: Keith Clark [mailto:keithcl...@k-wbookworm.com] Sent: Friday, March 12, 2010 7:57 AM To: mysql@lists.mysql.com Subject: Re: Nested inserts possible? Johan, That seems to be the ticket. Thanks! Keith On Fri, 2010-03-1

Re: Nested inserts possible?

2010-03-12 Thread Keith Clark
Johan, That seems to be the ticket. Thanks! Keith On Fri, 2010-03-12 at 16:54 +0100, Johan De Meersman wrote: > Have a look at last_insert_id(). > > On Fri, Mar 12, 2010 at 3:48 PM, Keith Clark > wrote: > I have two tables and I have data to insert into both at the > same time

Re: Nested inserts possible?

2010-03-12 Thread mos
Keith, You will need to reference the mysql_insert_id() function after adding the row to Table_One. Then use the value returned for the rest of the tables. http://dev.mysql.com/doc/refman/5.1/en/getting-unique-id.html Mike At 08:48 AM 3/12/2010, you wrote: I have two tables and I have

Nested inserts possible?

2010-03-12 Thread Keith Clark
I have two tables and I have data to insert into both at the same time, but the second table depends on an ID that is auto created in the first table. I'm not sure exactly how to accomplish this. Table_One Table_One_Index_ID Data_One Date_Two Table_Two Table_Two_Index_ID Table_One_Index_ID Dat