Yeah,
I've abandoned the nice neat insert . . . select.
Instead I am selecting the table B dataset, inserting each row into
table A, capturing the insert id, populating the x-ref, and going on to
the next row.  Twice as much code, but it works.

Andrew Hazen

-----Original Message-----
From: Paul DuBois [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 20, 2002 1:12 PM
To: Andrew Hazen; [EMAIL PROTECTED]
Subject: Re: x-ref insert from within an insert. . .select

At 11:42 -0500 3/20/02, Andrew Hazen wrote:
>Hi,
>I am loading table A from values in table B with an insert . . . select
>statement.
>I also need to populate a x-ref table with the new insert ids from the
>insert . . . select.
>
>I know in Oracle I would put a trigger in to do the x-ref insert after
>each row of the insert. . .select is processed.
>
>Is there anyway to do this in mysql/php?

Yes, you do it yourself. :-)

You'll probably find the PHP mysql_insert_id() function helpful in
your situation.

>
>
>Spamfilter: mysql
>
>Andrew Hazen
>Database Developer
>Jatech Solutions Inc.
>160 Bartley Drive
>Toronto, ON
>M4A 1E1
>www.jatech.ca
>416-288-9833
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to