Jonas,

After the insert, execute

SELECT LAST_INSERT_ID();

This always gives the last auto increment value generated by your database
connection.

Andy

> -----Original Message-----
> From: Jonas Geiregat [mailto:[EMAIL PROTECTED]
> Sent: 18 June 2003 19:26
> To: 'Mysql'
> Subject: probably a stupid question
>
>
> Hey,
> Here is what I want to do
> I have 2tables
> let's say table A and B for simplicity.
> in table A I have column id
> and in table B I have column A_id
>
> 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 ?
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/[EMAIL PROTECTED]
>
>



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

Reply via email to