[EMAIL PROTECTED]:
> Robert Crowell <[EMAIL PROTECTED]> wrote on 11/11/2005 12:39:37 AM:
> > If I am relying on MySQL's AUTO_INCREMENT feature for the id for a
>  table,how
> > can I reliably retrieve the ID of an item I just entered into the
> database?

> TFM is your friend. What you are looking for is LAST_INSERT_ID()

Or mysql_insert_id() in the client library – or the equivalent function that 
ought to be in any binding for another language.


Speaking of LAST_INSERT_ID(), does anyone know how MySQL is supposed to 
process a statement like this:?

insert into some_table (ref_field, other_field)
values (last_insert_ID(), 1), (last_insert_ID(), 2);

I've looked in the manual for details on which order that statement is 
processed in, but I haven't found an answer.

Björn Persson

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

Reply via email to