On 18-Jun-2003 Jonas Geiregat wrote:

<snip> 

> I insert a new value into table A insert into a values(NULL)
> Since id is auto_incremenet and the primary key it will have an auto
> value.
> Now I want that the column A_id contains that id nr.
> I could query for the biggest id in column A and insert that into B.
> But are there better way's of doing something like this ?
> 

INSERT INTO tbl_B (A_id, ...)
 VALUES (LAST_INSERT_ID(), ...)

Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.
                            (53kr33t w0rdz: sql table query)


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to